-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
yacc conflicts #44
Comments
I would add: charmap: (const produces string) Cases 2 and 3 cause reduce/reduce conflicts that are correctly handled but reduce/reduce conflicts should really be solved explictly. This could be done by detaching the string productions like this: const: const_n: Then, use const_n instead of const in charmap. Do the same for relocconst and const_8bit. Case 1 causes a shift/reduced conflict that is correctly solved. This conflict is controlled and could be left as is. We could solve cases 1, 2 and 3 by associating a struct value to const and relocconst instead of a numeric value to allow ids, strings and numerical values to be "returned" and then use function calls to convert this struct to int where required. |
Here are two other conflicts - at first sight - due to grammar ambiguities:
Removing the redundant rules won't solve the conflicts because in fact this part e.g.: for z80_ld_sp:
There is no enough lookahead information to determine if the parser are recognizing the generic productions (T_Z80_LD reg_ss comma...) A solution is to use reg_ss in the specific rules and test if reg_ss is well a T_MODE_SP or T_MODE_HL. |
The last one mentioned by @chastai has been fixed in 362aea2 |
There is only one conflict not mentioned here.
If the parser encounters This means that |
Implements the fix suggested [here](gbdev#44 (comment)), which performed better than expected! I'm not \*too\* fond of this but this seems like the right way
I have no experience in YACC, but there appears to be one more shift/reduce in
|
Yeah, there are a couple more. Here are the two problems we currently have: Both are technically not ambiguous, but require two ( Also, the two unused terminals are intended, the lexer doesn't read them (macro/rept management is whack) but they're still reserved keywords. |
Since colon-less labels have been removed (removing the |
yacc warns about some conflicts and then chooses whatever default it seems was more likely intended. We should remove those conflicts.
I don't understand the yacc language that well, but here's what I was able to figure out.
The text was updated successfully, but these errors were encountered: