Re: [Pydev-code] Parser Stuff
Brought to you by:
fabioz
From: Fabio Z. <fa...@gm...> - 2006-01-31 10:04:29
|
Hi Steve, Well, I've only played with the javacc plugin for eclipse, and it was not really that complete, but it gave you syntax highlighting and the outline (which was actually quite useful), so, in the end I thought it was worth it... Actually, I didn't really get any tutorial about it, but 'javacc tutorial' on google appeared to give some good examples: http://www.engr.mun.ca/~theo/JavaCC-Tutorial http://www.idevelopment.info/data/Programming/java/JavaCC/The_JavaCC_FAQ.ht= m etc. The asdl does not have much on documentation too, but as it is pretty simple, that's not much of a drawback. You basically have to create its structure (org.python.parser.TreeBuilder is the class that does it in pydev -- it has a huge switch on the method closeNode that actually decides what is being generated... I thought about making that big switch into a better structure, using some HashMap that had actions dependending upon the node that has just been closed, but never got to the point to do it). Also, to transverse the tree later, you can look at the EasyASTIteratorVisitor class -- it has a unit-test that may prove useful to check out to see how it works. Cheers, Fabio On 1/31/06, steve hindle <me...@gm...> wrote: > > > Hi Fabio, > > This is basically just a test message to make sure my list subscription > is active. > > As you mentioned, since ASDL provides the interface description, either > javaCC or ANTLR would > work. Doesn't really seem to be much point in switching unless we really > get something from it > though. I might try hacking the ANTLR grammar to meet the ASDL spec, jus= t > to make sure I > really understand the ASDL description. Then I can try hacking the javaC= C > parser. > > This way, I get the ASDL stuff straight in my head, and you can play with > the ANTLR grammar > and see if it has any benefits over the javaCC stuff. > > Of course, thats assuming I actually figure the ASDL stuff out enough to > be useful :-) > > One thing that would be really useful is any javaCC tutorials/docs you > might know about? > the website was pretty sparse on documentation. Also, both ANTLR and > JavaCC have > Eclipse plugins - have you tried the javaCC one? Is it any easier to wor= k > with then just > hacking the grammer in 'vi' ? (I'm pretty new to eclipse/java stuff, so > setting up complicated > 'builders' in eclipse is more of a pain for me then just calling stuff > from the command line) > > Steve > > |