[antlr-interest] Language-Neutral Actions
Oliver Zeigermann
oliver.zeigermann at gmail.com
Fri Apr 15 06:40:19 PDT 2005
Or maybe something like language neutral setting of properties with
data retrieved in parsing. In Java this could be filling of beans. I
think in C# there is a similar and even more complete mechanism.
Oliver
On 4/15/05, Scott Stanchfield <scott at javadude.com> wrote:
> I'd really like to see language-neutral actions in ANTLR 3.
>
> The basic idea is that all action code is simply calls to behavior methods
> in some other object.
>
> Depending on what target language is specified, different "glue" code is
> formed to contact that other object.
>
> This would allow a grammar to be targeted to pretty much any language.
>
> Some old parser generators I used did things like
>
> foo: fee fie fo @doSomething(fee,fie,fo);
>
> which would allow you to target it to multiple languages. The parser
> generator would change @doSomething(...) into whatever was appropriate for
> the target language.
>
> I don't know that we'd want to use the same syntax (I like the {...} for
> actions), but we could have a grammar option that specifies language-netrual
> actions and all {...} code is assumed neutral.
>
> Thoughts?
> -- Scott
>
>
More information about the antlr-interest
mailing list