Questions & Answers of Lexical analysis

Weightage of Lexical analysis

Total 6 Questions have been asked from Lexical analysis topic of Compiler Design subject in previous GATE papers. Average marks 1.33.

A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}.
 

T1: a? (b|c)*aT2: b? (a|c)*bT3: c? (b|a)*c

 
Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix.
 
If the string bbaacabc is processed by the analyzer, which one of the following is the sequence of tokens it outputs?
 

Match the following:

(P) Lexical analysis (i) Leftmost derivation
(Q) Top down parsing (ii) Type checking
(R) Semantic analysis (iii) Regular expressions
(S) Runtime environments (iv) Activation records

Match the following:

P. Lexical analysis
Q. Parsing
R. Register allocation
S. Expression evaluation
   1.   Graph coloring
   2.   DFA minimization
   3.   Post-order traversal
   4.   Production tree

In a compiler, keywords of a language are recognized during

Which data structure in a compiler is used for managing information about variables and their attributes?

Which of the following statements are TRUE?

I.  There exist parsing algorithms for some programming languages whose complexities are less than θ(n3).
II.  A programming language which allows recursion can be implemented with static storage allocation.
III.  No L-attributed definition can be evaluated in the framework of bottom-up parsing.
IV. Code improving transformations can be performed at both source language and intermediate code level.