I am building a parser for a language that has the following syntax

    <name args*>

for function invocations and a few "function-like" usages.  In 
particular, statements such as

    Set <array 5> 17

are valid for a handful of predefined names.  In my grammar, I have a 
rule which describes what's allowed to be on the left-hand side of an 
assignment and I'm trying to decide between two possibilities for 
handling these "function-like" cases:

1) I could go with something that matches '<' ID expr* '>' and then in 
the parser action, I can test ID.text and act as appropriate

or

2) I could do something like

lhs
   : '<' 'array' expr '>' ->  ^(ARRAY_REF expr)
   | '<' 'socket' expr '>' -> ^(SOCKET_REF expr)
   | ...
   ;


Is either alternative especially better than the other?

Matt






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