[antlr-interest] aspectANTLR sketch

mzukowski at yci.com mzukowski at yci.com
Tue Jun 18 09:29:13 PDT 2002


Pointcuts for inserting actions:
	rules
		initialization
		specific alternatives
		finalization
		exception handling
		tree construction
		options?
	grammar
		header (includes variables and methods)
		options
extesions:
	tokens:
		regular tokens
		literal table
		tree node tokens (so called imaginary tokens)
	rules:
		adding alternatives

It seems like some concept of a grammar namespace would be appropriate if we
are serious about composing a grammar from multiple rule sets.  Likewise
token management could improve through composition.

Proof of concept for some of this should be possible through a preprocessor.
I would write:

1. an antlr parser that parses .g files without actions (and without grammar
subclassing for simplicity)
2. an aspectANTLR parser and weaver that would parse some sort of aspect
syntax for recognizing the above pointcuts and would generate a .g file with
actions for input to ANTLR.  It would also allow an extension syntax similar
to Metamorphic Syntactic Macros to extend the grammar, but wouldn't have any
fancy analysis.

It wouldn't have any hooks for the code generation stuff, but would at least
be a proof of concept for handling actions and extensions for grammars.  It
would be nice for refactoring the GCC grammar too.  

Anything I'm forgetting?

Monty

 

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



More information about the antlr-interest mailing list