Skip to content

Instantly share code, notes, and snippets.

@danking
Created October 19, 2011 13:14
Show Gist options
  • Save danking/1298243 to your computer and use it in GitHub Desktop.
Save danking/1298243 to your computer and use it in GitHub Desktop.
Grammar
0 $accept: foo $end
1 foo: foo A
2 | A
Terminals, with rules where they appear
$end (0) 0
error (256)
A (258) 1 2
Nonterminals, with rules where they appear
$accept (4)
on left: 0
foo (5)
on left: 1 2, on right: 0 1
state 0
0 $accept: . foo $end
1 foo: . foo A
2 | . A
A shift, and go to state 1
foo go to state 2
state 1
2 foo: A .
$default reduce using rule 2 (foo)
state 2
0 $accept: foo . $end
1 foo: foo . A
$end shift, and go to state 3
A shift, and go to state 4
state 3
0 $accept: foo $end .
$default accept
state 4
1 foo: foo A .
$default reduce using rule 1 (foo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment