Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created February 20, 2018 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Leonidas-from-XIV/052bdb3277d90ccea8802a68764ed2f6 to your computer and use it in GitHub Desktop.
Save Leonidas-from-XIV/052bdb3277d90ccea8802a68764ed2f6 to your computer and use it in GitHub Desktop.
Shift-reduce conflict with arbitrary resolution
Warning: one state has shift/reduce conflicts.
Warning: one shift/reduce conflict was arbitrarily resolved.
File "src/variable/parser.mly", line 16, characters 3-3:
Warning: production value_sequence -> is never reduced.
Warning: in total, 1 productions are never reduced.
%start <Types.value list> prog
%%
prog:
| EOF
{ [] }
| v = value_sequence; EOF
{ v }
;
value_sequence:
| (* empty *) { [] }
| seq = rev_value_sequence
{ List.rev seq }
;
rev_value_sequence:
| v = value
{ [v] }
| seq = rev_value_sequence; v = value
{ v :: seq }
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment