Compiler Design (2170701)

BE | Semester-7   Winter-2018 | 15/11/2018

Q3) (a)

Define the following terms and give suitable example for it.
1) Augmented Grammar  2) LR(0) Item  3) LR(1) Item

Augmented grammar :

  • If a Grammer G having start symbol S then augmented grammar is the new grammar G’ in which S’ is a new start symbol such that S’ -> .S
LR(0) Item :
  • An LR (0) item is a production G with dot at some position on the right side of the production.
  • LR(0) items is useful to indicate that how much of the input has been scanned up to a given point in the process of parsing. In the LR (0), we place the reduce node in the entire row.
LR(1) Item :
  • An LR(1) item of a CFG G is a string of the form A ? [a • ß,a], where A ? aß is a production in G, and a is a terminal of G or the special symbol e.