[antlr-interest] ANTLR 3.0 question about common actions
Terence Parr
parrt at cs.usfca.edu
Wed Jul 28 13:19:03 PDT 2004
Howdy,
We have an interesting problem to solve for the ANTLR 3.0 regarding
multiple target languages and free-form actions. I'd like your help.
There are two problems with the existing ANTLR regarding
actions/targets. A grammar built for one language has to be manually
updated to work for another output target. In other words, tree
construction for C++ won't work with C# or Java as a back-end. You
have to update it if you have any actions other than the ^ and ! AST
operators in your grammar.
Further, think about all the $setType and newline() nonsense in the
lexer. Each target may have different requirements so actions must
have a special parser etc... to handle actions. Yuck.
For the common things like symbol table management, AST construction,
and lexer actions, I propose a standard syntax that can easily be
translated to a target language. The only issue is, how do you handle
conditional code execution? For example, you only want to set the
token type in a lexer rule upon some complicated expression that you
want to express in the target language?
So, the main question is: how can we make standard actions in order to
avoid retargeting issues and yet allow for free-form actions,
especially those that predicate standard actions?
Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list