[antlr-interest] Control Flow in an Interpreter

Frank Smith fasmith718 at gmail.com
Sun Jul 29 19:07:45 PDT 2007


Hi all.  I have been using ANTLR 3.0 for a class project to make an
interpreter.  However, all of the professor's notes date back from the days
of ANTLR 2.0.  When I asked him for advice as to how to implement control
flow in an interpreter (e.g. if statements, function calls, etc.) he refers
me to ANTLR 2.7.2 generated code.

In the walker code he gave me the expr rule takes an AST as an argument:
public final  MxDataType  expr(AST _t) throws RecognitionException {...}

The expr code that ANTLR 3.0 generates for me does not take an argument,
however.  I have combed over the wiki for ANTLR 3.0 and closely looked over
the "moving from ANTLR 2.0 to ANTLR 3.0" article.

The best info i found was in the "creating an interpreter" article.  But is
the best way to implement general control flow in ANTLR 3.0 to push nodes
onto the input stack as in the interpreter article?  I would appreciate a
little help from the veterans here as my prof. has yet to update any of his
info for the new frontier of 3.0.

Thanks in advance!
     Frank A. Smith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070729/78e37d2e/attachment.html 


More information about the antlr-interest mailing list