Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Describe language processing system with a neat diagram

With a neat diagram, explain the various phases of compiler.


Use these phases to translate a=bc*cd+50.00 into the target code in assembly language.
Define tokens, patterns, lexemes.
A token is a pair consisting of token name and an optional attribute value.

A sequence of characters in the source program that matches the patterns


such as identifiers, numbers, relational operators, arithmetic operators,
symbols such as #, [, ], (, ) and so on are called lexemes.

The description of a lexeme is called pattern.


Give the reasons, why the analysis of a compiler is separated into lexical
analysis and parsing phases.

What is meant by input buffering? Write an algorithm for look ahead code
with sentinels.
The method of reading a block of characters (1K or 4K or more bytes) from the
disk in one read operation and storing in memory (normally in the form of an
array) for further processing and faster accessing is called input buffering.

Size of each buffer is N.  N is usually the size of a disk block, eg., 4096 bytes.
One system read command can be used to read N characters into a buffer,
instead of using one system call per character.
Here, buffer end test can be done by using sentinel character at the end of the
buffer. Eof is sentinel character
\

Construct the transition diagram to recognize the tokens


(i) Identifiers
(ii) relational operators
(iii) unsigned numbers

You might also like