Hi, it's my first time posting in a mailing list like this so go easy on me
if I'm breaking some etiquette or anything :)

I'm trying to construct an expression in my tree grammar to recognize an AST
of simple mathematical expressions like 1+(-(a-b)) in tree format of (+ 1 (-
(- a b))) that is generated by my parser grammar.

I've tried a couple of different approaches and I can't figure out where I'm
going wrong. Could someone explain what's wrong with the following two
expressions:
expression
    :    (MINUS^)? term;
term
    :    constant | variable | ^(operator expression expression);
[constant and variables are both terminators, operator is plus/minus].

It seems whenever I try it I get a load of messages saying "node from line
0:0 no viable alternative at input 'UP'" and the program doesn't work on
anything with a negative term preceding it.

Thanks for the help. If I haven't included enough information to be useful
please let me know!

-- 
Alex Storkey <[email protected]>

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.

Reply via email to