-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
partial (a4): for reduce/reduce conflict
- Loading branch information
1 parent
999bde1
commit 09a6944
Showing
5 changed files
with
176 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
15_A4.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr] | ||
15_A4.y: warning: reduce/reduce conflict on token ELSE [-Wcounterexamples] | ||
First example: type_specifier declarator $@4 '{' IF '(' expression ')' marker statement • ELSE marker statement '}' $end | ||
First reduce derivation | ||
$accept | ||
↳ translation_unit $end | ||
↳ external_declaration | ||
↳ function_definition | ||
↳ type_specifier declarator $@4 compound_statement | ||
↳ '{' block_item_list '}' | ||
↳ block_item | ||
↳ statement | ||
↳ selection_statement | ||
↳ IF '(' expression ')' marker statement guard ELSE marker statement | ||
↳ • | ||
Second example: type_specifier declarator $@4 '{' IF '(' expression ')' marker IF '(' expression ')' marker statement • guard ELSE marker statement '}' $end | ||
Second reduce derivation | ||
$accept | ||
↳ translation_unit $end | ||
↳ external_declaration | ||
↳ function_definition | ||
↳ type_specifier declarator $@4 compound_statement | ||
↳ '{' block_item_list '}' | ||
↳ block_item | ||
↳ statement | ||
↳ selection_statement | ||
↳ IF '(' expression ')' marker statement guard ELSE marker statement | ||
↳ selection_statement | ||
↳ IF '(' expression ')' marker statement • |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
char a; | ||
char b; | ||
|
||
int main() { | ||
if (a >= b + 13 || a < 0 ) { | ||
a = 5; | ||
} else if (a > 5) { | ||
b = 10 | ||
} else if (b < 1) { | ||
b = a; | ||
} else { | ||
a = a = 1; | ||
} | ||
} |