Hi
I am trying to convert from one language to another using tree
grammar. I have built a parser and am in the process of writing a tree
grammar. I am facing problem in accessing the variable name. My tree
grammar is as follows:
specification_root : ^(SPECIFICATION specification) ->
^(INPUT_VARIABLES specification);
specification : ^('=' KEYWORD_f expr);
expr : ^((',' | ('&'?) | ('|'?)) expr*) | exp;
exp : ^(('+' | '-' | '>' | '<' | '>=' | '<=' | '=' | '!=') exp*) | term;
term : ^(('*' | '/') term*) | LITERAL;
I want to access the name of the LITERAL which appears in the parser
AST in place of expr in specification rule. So that the rewrite would
be looking like:
('=' f (+ x y)) -> (x y)
I just want to retain the name of the variables in the rule. Can
anyone please tell me how to go about it.
Thanks
Swathy
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---