0% found this document useful (0 votes)
72 views8 pages

LP 2005

This document contains two sets of exam questions for a Language Processors course. It focuses on topics like lexical analysis, parsing, grammars, code generation, runtime storage, and macro processing. The questions cover concepts, constructing examples like NFAs and parse tables, writing algorithms, and more. The document provides a comprehensive set of exam questions for assessing knowledge of language processors and compilation techniques.

Uploaded by

andhracolleges
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views8 pages

LP 2005

This document contains two sets of exam questions for a Language Processors course. It focuses on topics like lexical analysis, parsing, grammars, code generation, runtime storage, and macro processing. The questions cover concepts, constructing examples like NFAs and parse tables, writing algorithms, and more. The document provides a comprehensive set of exam questions for assessing knowledge of language processors and compilation techniques.

Uploaded by

andhracolleges
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

www.andhracolleges.

com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 1


III B.Tech II Semester Supplementary Examinations,
November/December 2005
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks

www.andhracolleges.com
⋆⋆⋆⋆⋆

1. (a) What is the role of lexical analyzer. [6]


(b) Construct an NFA for the regular expression R=(a+b)* abb convert it in to
an equivalent DFA. [10]

2. (a) Distinguish between simple precedence and operator precedemce parsing tech-
niques. [6]
(b) Construct simple precedence parse table for the following grammar.
E ← E + T|T
T → T∗ F|F
F → (F)|id [10]

3. Construct cannonical LR pars table for the following grammer.


S → L =R
S→L
L →∗ R
R→L [16]

www.andhracolleges.com
4. Write type expression for the following types

(a) An array of pointers to real, where the array


index ranges from 1 to 100. [5]
(b) A two dimensional array of integers ( i.e an array of arrays)
whose rows are indexed from 0 to 9 and whose columns
are indexed from 10 to 10. [5]
(c) Functions whose domains are functions from integers to pointers to integers
and whose ranges are records consisting of an integer and a character. [6]

5. (a) What is an activation record? Explain how it is related with run time storage
organization. [8]
(b) Write a short notes on heap strategy and run-time storage allocation. [8]

6. (a) What are the various machine dependent code optimization techniques. [8]
(b) Convert the following arithmetic expression into syntax tree and three address
code
b* 3 (a+b) [8]
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
1 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information


www.andhracolleges.com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 1


7. (a) Augment the code generation algorithm to incorporate the following features.
[8]
i. The parenthesis in an expression
ii. Non commutative operators like ‘-‘ and ‘/’ etc
(b) Show various steps in the code generation algorithm of the expression
( a + b) / ( c + d)

www.andhracolleges.com
Assuming two machine registers to be available. [8]

8. (a) Write the design specification for a parameter in macro statement. [6]
(b) What is meant by Expansion time Variable ( EV). Write the syntax of two
forms of Expansion time variable. [5]
(c) How the value of EV can be manipulated through the preprocessor statement
SET. Explain with an example. [5]

⋆⋆⋆⋆⋆

www.andhracolleges.com
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
2 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information


www.andhracolleges.com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 2


III B.Tech II Semester Supplementary Examinations,
November/December 2005
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks

www.andhracolleges.com
⋆⋆⋆⋆⋆

1. Explain with one example how LEX program perform lexical analysis for the follow-
ing patterns in C : identifier, comments, numerical constants, arithmetic operators.
[16]

2. (a) Distinguish between simple precedence and operator precedemce parsing tech-
niques. [6]
(b) Construct simple precedence parse table for the following grammar.
E ← E + T|T
T → T∗ F|F
F → (F)|id [10]

3. (a) What are S-attributed and L-attributed grammars.


(b) Write a S-attributed grammer to connect the following grammer with prefix
rotater
L→E
E→E+T

www.andhracolleges.com
E→E-T
E→T
T→T*F
T→T/F
T→F
F→P↑ F
F→P
P→(E)
P→id. [6+10]

4. (a) List out some typical semantic errors . Explain how they can be rectified? [8]
(b) What is static checking ? Give some examples of static checks. [8]

5. (a) Write a notes on the static storage allocation strategy with examples and
discuss its limitations. [8]
(b) Discuss about the static allocation strategy of run-time environment with
examples. [8]

6. (a) Explain with an example how abstract machine code can be generated for a
given if-then-else statement. [8]
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
1 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information


www.andhracolleges.com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 2


(b) Write a short notes on peephole optimization. [8]

7. (a) Define Address Descriptor and Register Descriptor. [4]


(b) Why Next-use information is required for generating Object code? [6]
(c) What are the various object code forms. [6]

8. (a) List out the data structure to perform Macro Expansion. [8]

www.andhracolleges.com
(b) Write an algorithm for Macro processing. [8]

⋆⋆⋆⋆⋆

www.andhracolleges.com
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
2 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information


www.andhracolleges.com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 3


III B.Tech II Semester Supplementary Examinations,
November/December 2005
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks

www.andhracolleges.com
⋆⋆⋆⋆⋆

1. (a) Explain lexical analysis in detail. [8]


(b) What are the reasons for separating lexical analysis from syntax analysis. [8]

2. (a) Explain the reasons for separating lexial analysis phase from syntax analysis.
[6]
(b) Eliminate ambiguities from the following grammar
S → iEtSeS|iEtS|a
E → b|c|d [10]

3. (a) What are S-attributed and L-attributed grammars.


(b) Write a S-attributed grammer to connect the following grammer with prefix
rotater
L→E
E→E+T
E→E-T
E→T

www.andhracolleges.com
T→T*F
T→T/F
T→F
F→P↑ F
F→P
P→(E)
P→id. [6+10]

4. (a) Write a note on the specification of a Simple type checker. [8]


(b) Explain the equivalence of type expressions with appropriate examples. [8]

5. (a) What are the advantages and disadvantages of static storage allocation strat-
egy. [8]
(b) What are the advantages and disadvantages of heap storage allocation strat-
egy? [8]

6. (a) Give a translator grammar for converting boolean expression into three address
code. [8]
(b) Apply the translation scheme on the following expression a< b or c< d and
e< f. [8]
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
1 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information


www.andhracolleges.com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 3


7. (a) Explain the generic issues in the design of code generator. [8]
(b) Write about the various object code forms. [8]

8. (a) Explain the memory requirement for variant I and variant II of intermediate
code of an assembler design. [8]
(b) How Declarative state and Assembler directives are processed by an assembler.
[8]

www.andhracolleges.com ⋆⋆⋆⋆⋆

www.andhracolleges.com
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
2 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information


www.andhracolleges.com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 4


III B.Tech II Semester Supplementary Examinations,
November/December 2005
LANGUAGE PROCESSORS
(Computer Science & Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks

www.andhracolleges.com
⋆⋆⋆⋆⋆

1. Suppose we have the sequence of auxiliary definitions


A0 = a/b
A1 = A0 A0
A2 = A1 A1
.
. .
An = An−1 An−1 Followed by the pattern An .

(a) Informally describe the set of strings denoted by the pattern (as a function of
n) [6]
(b) If we substitute out all auxiliary definitions in the pattern, how long is the
regular expression [5]
(c) Show that 2n + 1 states are necessary for any NFA recognize An . [5]

2. (a) The grammar S → aSa|aa generates all even length string of a’s except for the
empty string. If a brute force method of top down parsor is used, it succeeds
of 2a’s, 4a’s, 8a’s but fails on 6a’s. Find out all even strings for which the

www.andhracolleges.com
parser succeeds. [8]
(b) List out the rules for constructing the simple precedence table for a CFG. [8]

3. Construct cannonical LR pars table for the following grammer.


S → L =R
S→L
L →∗ R
R→L [16]

4. (a) List out some typical semantic errors . Explain how they can be rectified? [8]
(b) What is static checking ? Give some examples of static checks. [8]

5. (a) What is an activation record? Explain how it is related with run time storage
organization. [8]
(b) Write a short notes on heap strategy and run-time storage allocation. [8]

6. (a) What are loop invariant components. Explain how they effect the efficiency
of a program. [8]
(b) Compare various forms of three address code. [8]
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
1 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information


www.andhracolleges.com The Complete Information About Colleges in Andhra Pradesh

Code No: RR320504 Set No. 4


7. (a) What is a flow graph. Explain how flow graph can be constructed for a given
program. [10]
(b) Compare the various forms of three address code. [6]

8. (a) List out the data structure to perform Macro Expansion. [8]
(b) Write an algorithm for Macro processing. [8]

www.andhracolleges.com
⋆⋆⋆⋆⋆

www.andhracolleges.com
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications
2 ofUSA-UK-Australia-Germany-France-NewZealand
2 Universities List

www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information

You might also like