Skip to content

Allow derivation which starts with "e" character#5

Merged
ymzk merged 3 commits intocsg-tokyo:masterfrom
Matts966:fix/starts-with-e-char
Mar 18, 2020
Merged

Allow derivation which starts with "e" character#5
ymzk merged 3 commits intocsg-tokyo:masterfrom
Matts966:fix/starts-with-e-char

Conversation

@Matts966
Copy link
Copy Markdown
Contributor

@Matts966 Matts966 commented Jan 26, 2020

For example, the syntax definition below causes an error.

syntax E (S) {
  Example : S  -> examples
  ExampleDerivations : examples -> examples example
  ExampleDerivation : example -> "example"
}

The error is like

typelevelLR: "e.syntax" (line 2, column 19):
unexpected "x"
expecting "eps"
CallStack (from HasCallStack):
  error, called at src/Generate.hs:31:22 in typelevelLR-0.1.0.0-7M2UNcQMvFw1r8bPLfq4Us:Generate

This is caused by the higher priority of "eps" rule than others.

So by making the priority of "eps" lower than other rules, we can allow rules which start with 'e' character.

I already ensured that the parser with this change can treat such a case without error.

Thank you :)

Update on 2/10: Fix bugs caused by recognizing eps as a terminal symbol by using backtracking and confirmed all the tests passed in the container developed in #6. Sorry for my incomplete check. Any additional requests are welcome.

@ymzk ymzk merged commit ca58538 into csg-tokyo:master Mar 18, 2020
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

Successfully merging this pull request may close these issues.

2 participants