How to create Parsing Table in Theory of Automata

 How to create Parsing Table in Theory of Automata, LL1 Parsing Table

LL(1) Parsing: 

The first L indicates that the input will be scanned from Left to Right, and the second L indicates that the Left Most Derivation Tree will be used in this parsing method. Finally, the number 1 denotes the amount of look-ahead symbols, or how many symbols you will view when making a choice.

The following are crucial conditions to look into first:

There is no left recursion in the grammar.

There should be no ambiguity in the grammar.

In order for the grammar to be deterministic, the grammar must be left factored.

These prerequisites are required but insufficient to prove an LL(1) parser.


LL(1) Parsing Table Construction Algorithm:

Step 1: Verify each of the prerequisites listed above before moving on to step 2.

Step 2: Perform First() and Follow() calculations on each non-terminal.


First(): The first terminal symbol is referred to as the First if there is a variable and we attempt to drive all the strings from that variable.

What is the terminal symbol that follows a variable during the derivation process?

3. For each production, enter. (A skews toward alpha)

Find First() and enter A -> for each terminal in First() in the table.

Find Follow(A) and put an entry in the table for each terminal in Follow(A) if First() contains the terminal (epsilon).

Make entry A-> in the table for the $ if First() includes and Follow(A) contains $ as terminal.

We have two functions available to build the parsing table:

The Non-Terminals will be in the table's rows, and the Terminal Symbols will be in the table's column. The Follow elements will cover all of the Grammars' Null Productions, while the First set of elements will cover the rest of the productions.

Now let's use an example to understand.

How to create Parsing Table in Theory of Automata , LL1 Parsing Table


Post a Comment

0 Comments