MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
How many sections are present in a LEX program?
A
2
B
3
C
4
D
6
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: -A lex program consists of three parts: the definition section, the rules section, and the user subroutines.

Detailed explanation-3: -The mandatory rules section opens with the delimiter %%. If a routines section follows, another %% delimiter ends the rules section. The %% delimiters must be entered at the beginning of a line, that is, without leading blanks.

Detailed explanation-4: -The Structure of LEX: It is also possible to write any C code here, which will be copied verbatim into the generated source file. It is bracketed with % and %. The Rules section is the most important section; Each rule is made up of two parts: a pattern and an action separated by whitespace.

Detailed explanation-5: -lex Specification File The input file can contain three sections: definitions, rules, and user subroutines. Each section must be separated from the others by a line containing only the delimiter, %% (double percent signs).

There is 1 question to complete.