Slide 26
Slide 26 text
descriptor, and jumps to execute the code associated with the grammar slot of
the descriptor. An example of a GLL parser is given below for the grammar 0
:
A ::= aAb | aAc | a.
R := ?; P := ?; U := ?
cU
:= (L0, 0); cI
:= 0; cN
:= $
L0
:
if
(R 6= ?) LA
:
add
(A ::= .aAb, cU , cI , $)
remove
(L, u, i, w)
from
R
add
(A ::= .aAc, cU , cI , $)
cU
:= u; cI
:= i; cN
:= w;
goto
L
add
(A ::= .a, cU , cI , $)
else if
(there exists a node (A, 0, n))
goto
L0
report success
else
report failure
L·aAb
:
if
(I[cI
] = a) L·aAc
:
if
(I[cI
] = a)
cN
:=
getNodeT
(a, cI , cI
+ 1) cN
:=
getNodeT
(a, cI , cI
+ 1)
else goto
L0 else goto
L0
cI
:= cI
+ 1 cI
:= cI
+ 1
cU
:=
create
(A ::= aA · b, cU , cI , cN
) cU
:=
create
(A ::= aA · c, cU , cI , cN
)
goto
LA goto
LA
LaA·b
:
if
(I[cI
] = b) LaA·c
:
if
(I[cI
] = c)
cR
:=
getNodeT
(b, cI , cI
+ 1) cR
:=
getNodeT
(c, cI , cI
+ 1)
else goto
L0 else goto
L0
cI
:= cI
+ 1 cI
:= cI
+ 1
cN
:=
getNodeP
(A ::= aAb·, cN , cR
) cN
:=
getNodeP
(A ::= aAc·, cN , cR
)
pop
(cU , cI , cN
);
goto
L0 pop
(cU , cI , cN
);
goto
L0
We describe the execution of a GLL parser by explaining the steps of the parser
at di↵erent grammar slots. Here, and in the rest of the paper, we do not include
A ::= aAb | aAc | a