so I'm doing this project where you order a forklift to do certain things with natural language and I'm using Python Lex Yacc. I wanted to know if there is a way to differentiate between permuted grammar that is the same length? The documentation only states that you can do it with len(p) but that only helps if they different in length. Sample code:
'''moveitemfromto : MOVEITEM fulltype item rack rack side
| MOVEITEM rack rack side fulltype item
| rack MOVEITEM fulltype item rack side
| rack MOVEITEM rack side fulltype item'''
If different productions (even for the same non-terminal) have different actions, then implement them in different functions. That is a normal and totally reasonable way to use Ply. Combining different production actions so that you have to figure out which production was reduced is false economy.