/    /  Compiler Design-Augmented Grammer, Closure, and Goto Operation

Augmented Grammer, Closure, and Goto Operation

 

Augmented Grammar

If a grammar G is having a start symbol S, then augmented grammar is a new grammar G’ , in which S’ is a new start symbol such that 

S’ → S

 

The purpose of this grammar is to indicate the acceptance of input. 

 

Closure Operation

If ‘I’ is a set of items for a grammar G then closure of I (closure (I)) is set of items constructed from I by 2 rules:

  • Initially, every item in I is added to closure(I).
  • If A → α • B β is in closure (I) and B ⟶ ४ is a production, then add the item B ⟶ •४ ti I, if it is not already in existence, we apply this rule until no more new items can be added to closure(I).

 

Goto Operation

The function goto can be defined as, if there is a production A → α • B β then goto ( A → α • B β , B) = A → α B • β. That means, simply shifting of “•” one position a head over grammar symbol.

 

Reference Link

Augmented Grammer, Closure, and Goto Operation