左递归&左分解LL(1)

时间:2017-06-14 05:30:05

标签: parsing compiler-construction left-recursion

我有这个问题的答案,但我仍然无法得到步骤和规则的步骤:

G = ({S,A}, {a, ( , ) , ”,” })

P =
S -> ()
S -> a
S -> ( A )
A -> S
A -> A , S

左递归:

S -> ()
S -> a
S -> ( A )
A -> SA’
A’ -> , S A
A’ -> eps

现在使用左分解:

(1) S -> (S’
(2) S’ -> )
(3) S’ -> A )
(4) S -> a
(5) A -> SA’
(6) A’ -> , S A
(7) A’ -> eps

0 个答案:

没有答案