2,369 views
8 votes
8 votes
A context free grammar can be used to model the lexical concerns of a HLL. This is not normally done and a regular grammar is used for the structure of lexemes because
(A) The cfg will blow up unnecessarily
(B) The structure of lexemes can be described by the simpler regular grammar
(C) There is a separation of concerns which controls complexity.
(D) All of the above

2 Answers

9 votes
9 votes
Ans should be D) All the above

A) yes it is true , as we know regular languages are implemented by finite automata which is more efficient to implement than context free languages implementation (using push down automata which is used stack ) .

B) structure of lexeme usually  be in letter(letter+digit )* and regular grammar describe it .

c) same reason as option a) .

for more detail ref: http://www.iith.ac.in/~ramakrishna/Compilers-Aug15/slides/02-lexical-analysis-part-1.pdf

Related questions

4 votes
4 votes
2 answers
2
jatin khachane 1 asked Nov 23, 2018
1,208 views
int main() { int a,b; a=10; b=15; printf("a=%d,b=%d",a++,b ); }The number of tokens in the above C program is_________.I am getting 30The answer given is 29
2 votes
2 votes
5 answers
3
Mizuki asked Nov 11, 2018
1,779 views
What it the number of tokens in the following line?printf("%d numbers.", &x);
1 votes
1 votes
2 answers
4
Lovejeet Singh asked Nov 7, 2018
1,159 views
How will the compiler detect whether "if" is a keyword or an identifier?Please tell me the concept behind this.