Skip to content

Rule aliasing does not work #137

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

Closed
wakita opened this issue Dec 20, 2012 · 4 comments
Closed

Rule aliasing does not work #137

wakita opened this issue Dec 20, 2012 · 4 comments
Assignees
Labels
Milestone

Comments

@wakita
Copy link

wakita commented Dec 20, 2012

One of the rules in my grammar is an alias like

H = Hexadecimal

Pegjs fails to generate parser function for H (parse_H) during alias elimination (substituting calls to parse_H by parse_Hexadecimal).

A quick workaround is changing the rule definition with

H = "" Hexadecimal
@dmajda
Copy link
Contributor

dmajda commented Dec 22, 2012

@wakita You don't explicitly mention that but I'll assume that you really complain about the fact that one can't start parsing from the eliminated rule. So the bug is that even rules specified in the allowedStartRules option get eliminated. Am I right or do you mean something else?

@wakita
Copy link
Author

wakita commented Dec 26, 2012

Thank you for your suggestion. Actually, I was not aware of this option. The version I was using, which is installed from npm, did not understand the "--allowedStartRules" option. I tried another version from the master branch.

And yes, you are right. I specified "--allowed-start-rules H1" for the following grammar.

H = "H"
H1  = H

The generated parser generates an entry for "H1" symbol but fails to generate its parser.

In my previous post, I assumed that any nonterminal symbol can be a starting symbol since it seemed to be so for almost all nonterminals.

@dmajda
Copy link
Contributor

dmajda commented Jan 1, 2013

In my previous post, I assumed that any nonterminal symbol can be a starting symbol since it seemed to be so for almost all nonterminals.

Yes, this is the expected behavior (modulo this bug) for version 0.7.0. You didn't specify the version in the original report, so I assumed master.

Anyway, I'll fix this once I have a minute.

@ghost ghost assigned dmajda Jan 1, 2013
@wakita
Copy link
Author

wakita commented Jan 2, 2013

Thanks!

@dmajda dmajda closed this as completed in 3981433 Jan 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants