[antlr-interest] Api question.

Kenneth Domino kenneth.domino at domemtech.com
Fri Jun 20 07:11:23 PDT 2008


Is there an API in the runtime to access the grammar during a parse?  I'm 
interested in knowing the rule and point in the rule corresponding to the 
action routine, making the action routine aware about the grammar itself. 
For example, an AST encoding "Expr:  Expr # { code(GiveMeMarkedUpAST()); } 
'+' Expr | Expr '-' Expr" would mean that the action "code()" is within the 
Expr rule, the first alternative.  This information is returned by the 
runtime code "GiveMeMarkedUpAST()".  The "#" would indicate the location of 
the parse action, like the dot used in LR items.  I could create a scheme to 
inform my action routine this information but I'm looking to see if Antlr 
can provide knowledge about the grammar in the form of an AST to the action. 



More information about the antlr-interest mailing list