Mihai Ciocoiu, Štefan Bruda * GULiveR: Generalized Unification Based LR Parser for Natural Languages
Fig. 1. - A parse table
2.1. The LR parsing algorithm
A LR Parser consists of a control
program which is the same for all grammars, and a parse table
with two components: ACTION and GOTO. The control program reads
tokens from the input string and uses a stack for storing sequences
like s0 X1 s1 X2 s2
Xm sm. Each Xi corresponds to a grammar
category and each si is a symbol called state. Depending on the
state sm on the top of the stack, and the current input token
ai, the control program looks for ACTION[sm, ai] which can be
one of:
A LR parser configuration is a
pair (s0 X1 s1 X2 s2
Xm sm, ai ai+1
an $) with the
first component being the stack contents and the second the remaining
input. On each step, the action of the parser is completely determined
by the contents of the parse table, as follows:
Based on an input string w
and a LR parse table for a grammar G, the parser returns
a parse tree for w, if or a message that . The initial
configuration is (s0, w $).
95