nearley
nearley copied to clipboard
Can I specify precedence?
Say I have an ambiguous grammar like:
main -> (ab | a | b):*
ab -> "ab"
a -> "a"
b -> "b"
Here "ab" can be interpreted as both "ab" or an "a" followed by a "b".
Is there a way to specify precedence in those situations? For example tell nearley that it should prefer "ab" over "a" followed by "b".
Or do I need to use Moo for that?
Thanks!
This is a situation where you should use moo to tokenize and disambiguate.