Professional Documents
Culture Documents
Analysis Phase:
Known as the front-end of the compiler, the analysis phase of the compiler reads the source
program, divides it into core parts and then checks for lexical, grammar and syntax errors.The
analysis phase generates an intermediate representation of the source program and symbol
table, which should be fed to the Synthesis phase as input.
190305105729 Page 1
2.Find the Regular Expression corresponding to given statement, subset of {l,d}* where l= letter
and d=digit.
1. The Language of all identifiers
2. The Language of all string constant in any programming language.
Ans. 1)(l+d)*
2)(d)*
3. How do the parser and scanner communicate? Explain with the block diagram
communication betweenthem.
Ans.
It’s main task is to read the input character and produce as output a sequence of tokens that
the parser uses for syntax analysis.
The block diagram of communication between scanner and parser is given below
Upon receiving a “get next token” command from parser, the lexical analyzer reads the
input characters until it can identify the next token.
4. Draw Transition diagram of unsigned integer and Keywords (for, while andif).
Ans.A grammar G is ambiguous if there is at least one string in L(G) having two or more distinct
derivation tree.
By just eliminating the immediate left-recursion, we may not get a grammar which is not left-recursive.
S Aa | b
recursive. S Aa Sca or