COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Output of Parser is
A
Syntax Tree
B
Parse Tree
C
Binary Tree
D
None of the above
Explanation: 

Detailed explanation-1: -Parser is a compiler that is used to break the data into smaller elements coming from lexical analysis phase. A parser takes input in the form of sequence of tokens and produces output in the form of parse tree. Parsing is of two types: top down parsing and bottom up parsing.

Detailed explanation-2: -Leaf nodes of parse tree are concatenated from left to right to form the input string derived from a grammar which is called yield of parse tree.

Detailed explanation-3: -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.

Detailed explanation-4: -The output from the parser is assumed to be a representation of the parse tree (example shown above) for the stream of tokens produced by the scanner. There are many approaches to parsing, including both top-down and bottom-up approaches, as well as using leftmost or rightmost derivation.

Detailed explanation-5: -Explanation: The tree, known as “Parse tree” when used in a compiler, is the data structure of choice to represent the source program.

There is 1 question to complete.