Erez Sh. wrote:
Sounds like you've got it! Yea, you need to leave the python code for the rules open to the dual usage. You can put special code in the "expr_list: var_list" rule, because if this gets reduced, it's an _expression_. You could also wrap the var_list in another rule for the assign, like "assign_var_list: var_list" which doesn't add any syntax, but then if you use "assign_var_list" in your assign rules, it will only be reduced there, and so you can put python code with that rule that only applies to assignments. Textually before, i.e., the line numbers in the .py file with your grammar in it. You had the var_list textually before the expr_list in the example grammar in your post. This should have produced a reduce/reduce conflict from ply.yacc (may need debug set?). -bruce --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ply-hack" 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/ply-hack?hl=en -~----------~----~----~----~------~----~------~--~--- |
- Parsing Ambiguity Erez
- Re: Parsing Ambiguity Bruce Frederiksen
- Re: Parsing Ambiguity Erez Sh.
- Re: Parsing Ambiguity Bruce Frederiksen
- Re: Parsing Ambiguity Andrew Dalke
- Re: Parsing Ambiguity Erez Sh.
- Re: Parsing Ambiguity Andrew Dalke
