[antlr-interest] Using ANTLR with manually-built ASTs
ewbank at gmail.com
Mon Jun 13 06:04:25 PDT 2005
I think the key requirements are in the ANTLR manual (pdf, located on
There's several function required of a class for it to be walkable...
- getType(), to report the type of the current node
- getFirstChild(), to return the first child (i.e., LHS branch)
- getNextSibling(), to return next sibling (i.e., RHS branch)
I'm sure there's (a bit?) more, but this is the start. I've also
found it useful to define standard begin and end methods so that your
nodes can be used by C++'s STL algorithms.
Hope this helps,
- Bryan Ewbank
On 6/13/05, Paul Johnson <gt54-antlr at cyconix.com> wrote:
> I'd like to implement an ANTLR tree parser for an existing compiler,
> with the recogniser in lex/yacc. Is this is a sensible thing to do?
> However, there doesn't seem to be any documentation on manually
> constructing ASTs to input to ANTLR - any pointers (preferably C++)?
More information about the antlr-interest