Popular posts from this blog
Syntax Tree
Download pdf What is Syntax Tree? Tree in which each leaf node describes an operand & each interior node an operator. The syntax tree is shortened form of the Parse Tree. Example1 − Draw Syntax Tree for the string a + b ∗ c − d. Rules for constructing a syntax tree Each node in a syntax tree can be executed as data with multiple fields. In the node for an operator, one field recognizes the operator and the remaining field includes a pointer to the nodes for the operands. The operator is known as the label of the node. The following functions are used to create the nodes of the syntax tree for the expressions with binary operators. Each function returns a pointer to the recently generated node. · mknode (op, left, right) − It generates an operator node with label op and two field including pointers to left and right. · mkleaf (id, entry) − It generates an identifie...
Derivation & Derivation Tree in Compiler Design (Left Most Derivation & Right Most Derivation)
Download pdf Derivation · The process of deriving a string is called as derivation . · The geometrical representation of a derivation is called as a parse tree or derivation tree. 1. Leftmost Derivation- · The process of deriving a string by expanding the leftmost non-terminal at each step is called as leftmost derivation . · The geometrical representation of leftmost derivation is called as a leftmost derivation tree . Example- Consider the following grammar- S → aB / bA A → aS / bAA / a B → bS / aBB / b ( Unambiguous Grammar ) Let us consider a string w = aaabbabbba Now, let us derive the string w using leftmost derivation. Leftmost Derivation- ...




Comments
Post a Comment