[antlr-interest] Example C style interpreter?

Brian Todoroff brian at todoroff.com
Tue Nov 27 17:52:11 PST 2007


Thanks.  That's more along the lines of what I was looking for.  It
appears that he basically takes the AST from ANTLR and writes his own
tree walker to evaluate the tree instead of using ANTLR to create the
execution walker.  That might be the better decision as it saves
keeping another copy of the grammar in sync and the tree parser has
already ensured a valid input stream, but I'll have to think on
that...

Thanks,
Brian


On Nov 22, 2007 8:34 AM, Johannes Luber <jaluber at gmx.de> wrote:
> Brian Todoroff wrote:
>  > Interesting example of a compiler to java (I like the idea of the
> > pipeline operator), but I'm really looking for an interpreter.
> > Something that takes the input code, creates the AST and actually runs
> > the code with function calls, loops, etc.
> > Doesn't need to be a fancy language and I don't care what language the
> > final interpreter code is in (C, C++, Java, C#, etc.).  I'm just
> > looking to get a feel for the design patterns around ANTLR based
> > interpreters for doing things like building up the function lookup
> > table and moving that between the parse and execute phases, handling
> > flow control constructs such as for, do, & while loops, etc.
> >
> > Thanks,
> > Brian
> >
>
> I totally forgot about this:
> http://www.codeproject.com/csharp/sota_expression_evaluator.asp
>
> Johannes
>


More information about the antlr-interest mailing list