Monday 15 February 2010

parsing - Handling nullable productions in LR(0) grammars -



parsing - Handling nullable productions in LR(0) grammars -

i think it's pretty straightforward question, couldn't find reply anywhere.

if have grammar non-terminal derivates null, this:

s -> b$ b -> idp p -> (e) p -> e -> b

how handle production #3 diagram lr(0) states of it? have include column corresponding transition empty set in lr(0) parsing table?

the item p -> · not different other item · @ right-hand end; fact nil precedes · not create special. closure of item

b -> id · p

will state q:

b -> id · p p -> · ( e ) p -> ·

from goto(q, p) indicate transition b -> id p · , goto(q, () indicate transition p -> ( · e ). goto on $ , ) not defined on state, action is; indicate p should reduced using p -> rule, after goto(q, p) used.

parsing syntax grammar

No comments:

Post a Comment