We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
is there a way for you to have an option of matching a nothing case in yacc. for example: A : B C B C : SOMETHING |
Or would I have to do A : B C B | B B C : SOMETHING
The text was updated successfully, but these errors were encountered:
What you need might be empty rules
I found out about that by googling "Empty sequence" on google, which yields me this stackoverflow post.
Sorry, something went wrong.
(I responded to this via email on the 13th, but it doesn't seem to have shown up here. Usually GH reflects them back up as issues if you respond.)
In bison there is a special token called %epsilon, which can be used to explicitly mark something as empty-by-intent:
%epsilon
https://www.gnu.org/software/bison/manual/html_node/Empty-Rules.html
C : SOMETHING | %empty
There is then some nice stuff which will warn you if you declare a production empty, but it isn't.
Doesn't work in classic yacc though, or older versions of bison. However, you can define a symbol called epsilon:
epsilon
epsilon : /* I am empty */
then use it in your grammar:
C : SOMETHING | epsilon
No branches or pull requests
is there a way for you to have an option of matching a nothing case in yacc.
for example:
A : B C B
C : SOMETHING
|
Or would I have to do
A : B C B
| B B
C : SOMETHING
The text was updated successfully, but these errors were encountered: