COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
no of sections in a lex program are
A
1
B
2
C
3
D
4
Explanation: 

Detailed explanation-1: -A lex program consists of three sections: a section containing definitions, a section containing translations, and a section containing functions.

Detailed explanation-2: -LEX is a program generator designed for lexical processing of character input/output stream. Anything from simple text search program that looks for pattern in its input-output file to a C compiler that transforms a program into optimized code. In program with structure input-output two tasks occurs over and over.

Detailed explanation-3: -A rule in a LEX program comprises of a ‘pattern’ part (specified by a regular expression) and a corresponding (semantic) ‘action’ part (a sequence of C statements). In the above example, “integer” is the pattern and return ID TYPE INTEGER; is the corresponding action.

There is 1 question to complete.