Im been trying to create a compiler using yacc/lex, but i can't seem to find how to make a direct access to the memory, similar to c++ like Array[2].
I have found some using strings, but im having dificults trying to generalize it for other types of data.
Thank you in advance.
Related
I am trying to do some deep code analysis on a python2 codebase that is large and messy enough that most analysis tools I've tried have not worked. I have however been able to use pycscope to generate a cscope database. I can even use it to do basic things like find function usages or all functions called directly from a given function.
To me, it seems like the fact that there is a database and that it can be used for simple things means that it should be possible to use it for more complex things too. For example if I wanted to find all functions that are called from within a given function recursively, or all codepaths that depend on that function.
However cscope documentation is very light and I'm not much of a c-expert. Is there an actual query language for it? An extension that knows how to use the database in this manner?
Does anyone know where there is a good example of how to use the asn1 Marshal and Unmarshal funcs in Go?
I'm familiar with the concept of how DER encoding with ASN.1 works, but do not have experience dealing with it directly in code (usually I'm using another library with wraps it - openldap or whatever).
Yes, I've looked at the documentation (http://golang.org/pkg/encoding/asn1/), which seems to describe a tagging system much like what is available for JSON and XML in Go; however I have yet to find a good practical example of this anywhere for the encoding/asn1 package. (Hm, okay I see the Certificate example in asn1_test.go - anyone know of anything else?)
(Overall, I'm trying to implement a very small subset of LDAP (the server side) in Go.)
UPDATE: My question is flawed by the fact that LDAP uses BER, not DER. So encoding/asn.1 isn't going to help. In any case, I ended up making this: https://github.com/bradleypeabody/godap (which uses this for BER+ASN1: https://github.com/go-asn1-ber/asn1-ber )
https://web.archive.org/web/20160816005220/https://jan.newmarch.name/go/serialisation/chapter-serialisation.html
and
https://ipfs.io/ipfs/QmfYeDhGH9bZzihBUDEQbCbTc5k5FZKURMUoUvfmc27BwL/dataserialisation/asn1.html
have quite a few examples with asn1.Marshal / asn1.Unmarshal
I have used the MongoDB driver more or less in C++ only. But now I need it also in C#.
For one of my functionalities I use the function "getFieldDotted" of class BSONObj to get a BSONElement is a deeper tree of the BSONObj.
It seems that an equiqalent functionality does not exits in C# driver!? All tries to use an "dotted" element name result in an exception "KeyNotFoundException" even if the key exist.
Any ideas?
From what I found out, there is no equivalent to the C++ driver "getFieldDotted" function.
The C# driver is able to use "array indices":
value=BsonDoc["Element"]["AnOtherElement"];
I used this. It is the best for my requirements accessing specific elements that are at fixed positions in the BSON object without looping or searching.
I googled, but I can't find a satisfactory answer. This SO question is related but kinda old as well as the exact opposite of what I am looking for: a way to do screen-scraping using XPath, not CSS selectors.
I've used enlive for some basic screen-scraping but sometimes one needs the power of XPath selectors. So here it is:
Is there any equivalent to Nokogiri or lxml for clojure (java)? What is the state of the "pure java Nokogiri"? Any way to use the library from clojure? Any better alternatives than this hack?
There are a couple of possibilities here.
Several of these require semi-well formed XML to work. If you don't have it, I would pair clj-tagsoup with hiccup to produce the XML (parse with clj-tag-soup, which produces a form that hiccup and write out as XML) and work with that.
First, just use the native JDK capabilities. Assuming the document is well formed enough, try using clj-xpath which provides a wrapper around the native JDK parsing.
If that doesn't suffice, consider taking a more Clojure data structure based route. A simpler path could just use the output of TagSoup and a combination of maps, filters, and nths.
If you need something more advanced, consider using zippers to provide structure around the data, making it easier to manipulate. Use clojure.xml/parse and clojure.zip/xml-zip to produce the zipper, and go from there. An example can be found at http://techbehindtech.com/2010/06/25/parsing-xml-in-clojure/.
Using the native structures is my preferred route for anything complicated, as you can bring the full power of the language to bear.
If you provide a sample of why you need XPath, I can provide some sample code.
The Botan library (botan.randombit.net/) has a number of algorithms for encryption/decryption. I am interested in using the XTS algorithm for encryption/decryption that is available within Botan. However, there is no example provided for XTS usage in the downloaded Botan library. I need to know the XTS algorithm for encryption/decryption from within Botan. I have been able to compile the Botan library on Windows using MSVC. I am also able to build a sample application that links with this library and use the LibraryInitializer function. From this point onwards, I am at loss.
Regards, Saif
This should be all you need to get started with Botan, regardless of what algorithm you're using:
http://botan.randombit.net/filters.html
I'll just put this here...
http://botan.randombit.net/pbkdf.html