MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Rule section in LEX always starts with
A
/*
B
//
C
##
D
%%
Explanation: 

Detailed explanation-1: -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-2: -lex solves the problem in one of two ways: an operator character preceded by a backslash, or characters (except backslash) enclosed in double quotation marks, are taken literally, that is, as part of the text to be searched for.

Detailed explanation-3: -BEGIN 0; resets the lex program to its initial condition. In start state one in the preceding example, both abc and def can be matched. In start state two, only ghi can be matched.

Detailed explanation-4: -A lex program consists of three sections: a section containing definitions, a section containing translations, and a section containing functions. The style of this layout is similar to that of yacc.

Detailed explanation-5: -Structure of a Lex Specification A lex program consists of three parts: the definition section, the rules section, and the user subroutines. The parts are separated by lines consisting of two percent signs. The first two parts are required, although a part may be empty.

There is 1 question to complete.