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

Remove exceptions from combinator parsers #95

Open
ceilican opened this issue Oct 7, 2013 · 0 comments
Open

Remove exceptions from combinator parsers #95

ceilican opened this issue Oct 7, 2013 · 0 comments

Comments

@ceilican
Copy link
Member

ceilican commented Oct 7, 2013

Andreas wrote:

isn't throwing exceptions considered to be a side effect and therefore the whole thing is not purely functional anymore?
In other words: aren't exceptions supposed to be handeled differently with combinational parsers?

There are lambda calculi with exceptions and there are functional languages with exceptions. Whether this makes them less pure is subjective, unless "purity" is objectively defined first. But you are right that there are better ways to handle and report errors when using combinator parsers. Scala provides the "failure" parser and the "Failure" parse-result for that. They are explained in chapter 31.9 of "Programming in Scala" (http://www.artima.com/pins1ed/combinator-parsing.html).

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

No branches or pull requests

1 participant