[antlr-interest] Re: how useful would a generic grammar "action" language be?

lgcraymer lgc at mail1.jpl.nasa.gov
Tue Oct 28 09:54:28 PST 2003


--- In antlr-interest at yahoogroups.com, "Arnar Birgisson" <arnarb at o...> 
wrote:
> How would the user clarify to ANTLR whether he/she is writing their
> actions in the target language, or the abstract action language?

Since Ter is just starting to investigate, this is clearly TBD.  I 
would personally favor only having actions in the "action language"; I 
believe that this can be done for type declarations with a 
configuration file which includes type definitions so that types can 
be referred to by name in the ANTLR grammar and you can hide the 
qualifiers and language specificity in the config file.  Almost 
anything can be encapsulated with a function call, so it should not be 
too difficult to define a small action language.  Most of the 
complexity is likely to be in dealing with expressions.

> Having grammars with actions and all (even just the simple ones) 
would
> be very cool, and it would help out alot when people distribute 
grammars
> and/or use grammars from others. But if the implementation of this 
would
> mean alot of work, is it worth it?

There is already an action filter for each target language, and I 
suspect that a port of the action language would only be slightly more 
work than writing a filter.  One of my minor complaints has been that 
AST class code should be generated from specifications and there 
should be an ANTLR way of referencing instance variables (attributes) 
in a non-language-specific way.  Having an action language would be a 
good way to address that.

There are some big wins possible here.  Consider the fairly common 
problem of retargeting a language grammar--to go from a java 
environment to C# or C++ or OCaml, for example.

--Loring

> Arnar


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list