Recursive descent parser

RECURSIVE DESCENT PARSER

A parser that uses collection of recursive procedures for parsing the given input string is called Recursive Descent (RD) Parser.

Basic steps for construction of RD parser:
  1. The R.H.S. of the rule is directly converted into program code symbol by symbol.
  2. If the input is non-terminal then a call to the procedure corresponding to the non-terminal is made. 
  3. If the input is terminal then it is matched with the look ahead from input. The look- ahead pointer has to be advanced on matching of the input symbol. 
  4. If the production rule has many alternates then all these alternates has to be combine into a single body of procedure. 
  5. The parser should be activated by a procedure corresponding to the start symbol. 
Predictive LL (1) parser

This top down parsing algorithm is of non- recursive type. In this type of parsing a table is built. for LL(1):

The first L means the input is scanned from left to right.
The second L means it uses left most derivation for input string. & the number 1 in the input symbol (look-ahead) to predict the parsing process.

The data structure used by LL(1) are:
  1. Input Buffer
  2. stack
  3. parsing table

Construction of Predictive LL (1) Parser 

This parser is based on two very important function & those are FIRST and FOLLOW. 

For construction of predictive LL(1) parser we have to follow the following steps- 
  1. Computation of FIRST and FOLLOW function. 
  2. Construct the predictive parsing table using FIRST and FOLLOW functions. 
  3. Parse the input string with the help of predictive parsing table.

FIRST function 

Following are the rules used to compute the FIRST functions. 
  1. If the terminal symbol a the FIRST (a) = {a}. 
  2. If there is a rule X --> e then FIRST (X) = {e}. 
  3. For the rule A-->X1 X2 X3 .....Xk FIRST (A) = (FIRST (X1) U FIRST (X2) U FIRST (X3) .... U FIRST (Xk).
Where K Xj <= n such that 1<= j <= k-1.

FOLLOW function

The rule of computing FOLLOW function are as given below-
  1. For the start symbol S place $ in FOLLOW(S).
  2. If there is a production A --> aBb then everything in FIRST(b) without e is to be placed in FOLLOW(B). 
  3. If there is a production A --> aBb or A --> aB and FIRST (b) ={e} then FOLLOW (A) = FOLLOW(B) or FOLLOW(B) = FOLLOW (A). That means everything in FOLLOW (A) is in FOLLOW (B).
Compiler Design

EasyExamNotes.com covered following topics in Compiler Design.
Python Programming ↓ 👆
Java Programming ↓ 👆
JAVA EasyExamNotes.com covered following topics in these notes.
JAVA Programs
Principles of Programming Languages ↓ 👆
Principles of Programming Languages
EasyExamNotes.com covered following topics in these notes.

Practicals:
Previous years solved papers:
A list of Video lectures References:
  1. Sebesta,”Concept of programming Language”, Pearson Edu 
  2. Louden, “Programming Languages: Principles & Practices” , Cengage Learning 
  3. Tucker, “Programming Languages: Principles and paradigms “, Tata McGraw –Hill. 
  4. E Horowitz, "Programming Languages", 2nd Edition, Addison Wesley

    Computer Organization and Architecture ↓ 👆

    Computer Organization and Architecture 

    EasyExamNotes.com covered following topics in these notes.

    1. Structure of desktop computers
    2. Logic gates
    3. Register organization
    4. Bus structure
    5. Addressing modes
    6. Register transfer language
    7. Direct mapping numericals
    8. Register in Assembly Language Programming
    9. Arrays in Assembly Language Programming

    References:

    1. William stalling ,“Computer Architecture and Organization” PHI
    2. Morris Mano , “Computer System Organization ”PHI

    Computer Network ↓ 👆
    Computer Network

    EasyExamNotes.com covered following topics in these notes.
    1. Data Link Layer
    2. Framing
    3. Byte count framing method
    4. Flag bytes with byte stuffing framing method
    5. Flag bits with bit stuffing framing method
    6. Physical layer coding violations framing method
    7. Error control in data link layer
    8. Stop and Wait scheme
    9. Sliding Window Protocol
    10. One bit sliding window protocol
    11. A protocol Using Go-Back-N
    12. Selective repeat protocol
    13. Application layer
    References:
    1. Andrew S. Tanenbaum, David J. Wetherall, “Computer Networks” Pearson Education.
    2. Douglas E Comer, “Internetworking with TCP/IP Principles, Protocols, And Architecture",Pearson Education
    3. KavehPahlavan, Prashant Krishnamurthy, “Networking Fundamentals”, Wiley Publication.
    4. Ying-Dar Lin, Ren-Hung Hwang, Fred Baker, “Computer Networks: An Open Source Approach”, McGraw Hill.