Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade parsing algorithm to LR(1) #11

Open
alexdowad opened this issue Jan 6, 2014 · 0 comments
Open

Upgrade parsing algorithm to LR(1) #11

alexdowad opened this issue Jan 6, 2014 · 0 comments

Comments

@alexdowad
Copy link

Thanks to @cgrand for making this library available. However, unless the algorithm is upgraded to LR(1) (if not something even more powerful), it would be better to put a clear warning at the very beginning of the README, indicating that Parsley is useless for parsing infix expressions. This would save potential users hours of frustration.

Say you are parsing an expression-based language where both of the following are valid expressions:

 variable
 variable * 2

After Parsley reads "variable", it needs to decide whether to reduce or to eat more input, WITHOUT looking ahead. Unfortunately, without looking ahead, it can't see the "*" which is coming up next. So this results in a shift/reduce conflict.

Allowing regular expressions as terminals is nice, but unfortunately, Parsley can't break down regexps and examine their internal structure. In practice, this means a lot of shift/reduce conflicts are hidden and pop up at runtime as "Ambiguous Match" errors. (This happens very easily when regexps which can match 0 characters are used as terminals.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant