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

Indirect left recursion doesn't work in some cases #1

Open
inkytonik opened this issue Jun 14, 2020 · 1 comment
Open

Indirect left recursion doesn't work in some cases #1

inkytonik opened this issue Jun 14, 2020 · 1 comment
Assignees
Labels
bug Something isn't working Component: parsing Relating to the parsing component

Comments

@inkytonik
Copy link
Owner

inkytonik commented Jun 14, 2020

(Reported by Nicholas Weston.)

The parser p defined as follows doesn’t successfully parse ab.

lazy val p: PackratParser[Any] = q | "a"
lazy val q: PackratParser[Any] = p ~ "b"

The parse result is

Failure(end of input expected,Input(StringSource(ab,),1))

It works if q is a regular Parser. It also works if p is directly recursive as follows.

lazy val p: PackratParser[Any] = p ~ "b" | "a"

It also happens in 2.3.0-SNAPSHOT but not when using the standard Scala parser combinator library.

See attached project.

@inkytonik inkytonik added the bug Something isn't working label Jun 14, 2020
@inkytonik
Copy link
Owner Author

parsing-bug.zip

@inkytonik inkytonik self-assigned this Dec 8, 2020
@inkytonik inkytonik added the Component: parsing Relating to the parsing component label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Component: parsing Relating to the parsing component
Projects
None yet
Development

No branches or pull requests

1 participant