Hi, I'm wrinting a tool to that collect sparse single grammr productions and combine them together in order to generate the complete grammar definition.
In particular the colleted rules are transformed in Rats! modules in order to generate a Java Packrat Parser. My problem is that I need to give to the productions that define the same non terminal the correct priority (that in Rats! means the definition order in the module) in order to ensure that a shorter rules does not prevent a longer one to be choosen. Is there an efficient strategy to automatically check this constrain?? It's trivial in simple grammars like NonTerm1 <-- NonTerm3 / NonTerm2 NonTerm2 <-- NonTerm3 "sym" find out that NonTerm3 must have low priority than NonTerm2. but when I have something like this NonTerm1 <-- NonTerm2 / NonTerm3 NonTerm2 <-- NonTerm2A / NonTerm2B / NonTerm2C NonTerm3 <-- NonTerm3A / NonTerm3B etc..... In order to compare NonTerm3 with NonTerm2 I need to check for their definition and then recursevly check in their definition until I found out if NonTerm2 prevents or not the choice NonTerm3. Thanks Davide _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg