[antlr-interest] A newbie's question

Aki Niimura akineko at gmail.com
Tue Mar 17 17:43:08 PDT 2009


Hello everyone,

I'm very new to ANTLR3 and I'm still trying to figure out how this tool
works.
I have used Flex/Bison before so the experience does help.

I'm trying to use ANTLR3 with Python Target as that is the language I only
use in recent years.

>From reading tutorial and some examples for Python, it seems suggesting
three step approach:
(1) Lexer -> Token Stream
(2) Parser -> AST Stream
(3) Tree Parser (this is the place to embed the actions)

This is different from two step approach I'm familiar with when I learned
Flex/Bison.
However, I think three step approach provides cleaner implementation, so I
like it.

Only problem I see with the three step approach is that I need to write
almost identical grammar (yet not identical) for (2) and (3).

Now, I'm trying to use a complex grammar file that is created by somebody
else.
By using his grammar file, I can get (1) and (2) for free.
But it is not easy for me to write a Tree grammar rules for (3).

My question is:
Is there any way available to generate (3) skeleton file from (2) step?

I think (2) step has enough information to create a skeleton version of (3).
Then users can edit the file to insert necessary his application specific
stuff.

Any hint to facilitate (3) step is greatly appreciated.

Best regards,
Aki Niimura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090317/6161826f/attachment.html 


More information about the antlr-interest mailing list