You are on page 1of 2

Q. a) Explain with example what are tokens patterns & Lexemes?

(W-12/7M)
Q. a) Explain Tokens, atterns an! Lexemes with example" Ela#orate in !etail spe$i%i$ation o%
tokens" (&-1'/(M)

b) )i%%erentiate #etween the %ollowin*+
i) ,ront En! an! -a$k En! o% .ompilers
Advantage of front/back end division
This front/back division very much reduces the work for a compiling system that can handle several (N) source languages and
several (M) target languages. Instead of NM compilers, we need N front ends and M back ends. For gcc (originally standing for
Gnu C Compiler, but now standing for Gnu Compiler Collection), N=7 and M~30 so the savings is considerable.
The front and back end are themselves each divided into multiple phases. The input to each phase is the output of the previous.
Sometime a phase changes the representation of the input.
For example, the lexical analyser converts a character stream input into a token stream output.
Sometimes the representation is unchanged.
For example, the machine-dependent optimizer transforms target-machine code into (hopefully improved) target-machine code.
Conceptually, there are three phases of analysis with the output of one phase the input of the next. The phases are called lexical
analysis or scanning, syntax analysis or parsing, and semantic analysis.
ii) asses an! hases o% .ompilers" (&-1'//M)

You might also like