[antlr-interest] output=AST vs output=template

Johannes Luber jaluber at gmx.de
Wed Apr 25 07:45:36 PDT 2007


Marc-André Laverdière wrote:
> Hello,
> 
> I finally found out that buildAST was not a legal option anymore... but
> I see that now we have two options to have an option.
> 
> With AST, I need a tree adapter, with template, we're using
> stringtemplates... I don't know really either at all, and I'm wondering
> what I should use.
> 
> My first short term objective is to parse in order to find out if there
> are syntactical errors. Long term, I'm interested in translating from my
> domain-specific language to a more concrete language, but in a
> parametrized fashion.
> 
> Which approach is best for me?

For my own parser I chose the following:

1. The first pass is to create an AST. This should show up syntactical
errors.
2. The second pass processes the AST to discover semantical errors.
3. The third pass processes the AST again and generates the target with
StringTemplate.

Hope this helps,
Johannes Luber


More information about the antlr-interest mailing list