πŸŽ“ Computer Science & Engineering Portal

Master Engineering Disciplines with Structured Notes

Comprehensive academic lecture notes, exam-oriented unit summaries, laboratory manuals, and previous year question papers designed strictly for university students.

πŸ“‘

University Syllabi

AKTU & AICTE aligned semester guidelines.

πŸ“

Exam Question Papers

Previous 5 years solved university papers.

πŸ’‘

Lab Manuals & Viva

Practical codes with outputs & interview Qs.

Core Subjects & Units Hub

Click on any specific unit to immediately view its lecture notes below

Viewing All Lectures

Parse tree

Parse tree

  • Parse tree is the graphical representation of symbol. The symbol can be terminal or non-terminal.
  • In parsing, the string is derived using the start symbol. The root of the parse tree is that start symbol.
  • It is the graphical representation of symbol that can be terminals or non-terminals.
  • Parse tree follows the precedence of operators. The deepest sub-tree traversed first. So, the operator in the parent node has less precedence over the operator in the sub-tree.

The parse tree follows these points:

  • All leaf nodes have to be terminals.
  • All interior nodes have to be non-terminals.
  • In-order traversal gives original input string.

Example:

Production rules:

T= T + T | T * T  
T = a|b|c  

Input:

a * b + c

Step 1:

Parse tree1

Step 2:

Parse tree2

Step 3:

Parse tree3

Step 4:

Parse tree4

Step 5:

Parse tree5

Labels: ,

Discussion & Queries (<$I18NNumComments$>):

<$CommentPager$>
<$I18NAtCommentTimeWithPermalink$>, <$I18NCommentAuthorSaid$>

<$BlogCommentBody$>

<$BlogCommentDeleteIcon$>
<$CommentPager$>