[antlr-interest] Request:External action definitions
Anakreon Mejdi
amejdi at ertonline.gr
Tue Nov 26 03:41:25 PST 2002
I have an idea which might make antlr better.
Instead of defining the actions in the same file with the grammar
they could be defined in other file(s).
A way this could be achived(not necessarily the best) would be:
RULE:
'a' .. 'z' { %id; }
;
rule
:
RULE { %some_id; }
;
tree_rule
:
#(r:RULE { %tree_id; System.out.println("RULE matched"); }
;
In this case antlr.Tool will be fed with the grammar file and the
file(s) where actions are defined.
The actions identified with a label (like %id) will be searched among
the action files and the label should be replaced by the content of
the action.
Example:
id = {
System.out.println("Externaly defined action");
}
tree_id = {
System.out.println(r.getText());
}
This could be achieved with regular expressions but would be a primitive
implementation.
I'd like to know what you think about it.
Anakreon
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list