You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, Alec Thomas.
I'm trying to parse the input "aa" which should be valid accordding to the grammar, but the example program returns an error.
It seems like the parser is greedy and does not "give back", so the second expression of the Text property of the Example struct never consumes anything.
I have tried to created the "Let-dig" symbol as indicated by the grammar but as you can expect it had no effect.
I have also tried to rewrite this grammar somehow to eliminate the ambiguity but I couldn't come up with anything.
Is this my fault? Should I use some kind of regex expression to prevent the first expression from matching the last occurrence? I'm kind of lost here...
Cheers
The text was updated successfully, but these errors were encountered:
Hey, Alec Thomas.
I'm trying to parse the input "aa" which should be valid accordding to the grammar, but the example program returns an error.
It seems like the parser is greedy and does not "give back", so the second expression of the Text property of the Example struct never consumes anything.
Grammar:
Code:
Error:
panic: 1:3: unexpected token "<EOF>" (expected (<alpha> | <digit>))
I have tried to created the "Let-dig" symbol as indicated by the grammar but as you can expect it had no effect.
I have also tried to rewrite this grammar somehow to eliminate the ambiguity but I couldn't come up with anything.
Is this my fault? Should I use some kind of regex expression to prevent the first expression from matching the last occurrence? I'm kind of lost here...
Cheers
The text was updated successfully, but these errors were encountered: