Home /University Of Sargodha (UOS) /Compiler Construction

University of Sargodha BS 6* Term Examination 2015 Subject: Computer Science Paper: Compiler Construction (CS-443) Time Allowed: 2:30 Hours 12BSCS SIS Maximum Marks: 80

University of Sargodha BS 6* Term Examination 2015 Subject: Computer Science Paper: Compiler Construction (CS-443) Time Allowed: 2:30 Hours 12BSCS SIS Maximum Marks: 80 — page 1

Discussion

Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.

Your email is only used to send you replies and occasional Ustadni updates. It is never shown publicly.

Log in to post under your name

No questions yet — be the first to ask.

More Compiler Construction papers

See all

Paper text

University of Sargodha

BS 6* Term Examination 2015

Subject: Computer Science Paper: Compiler Construction (CS-443)

Time Allowed: 2:30 Hours

12BSCS SIS

Maximum Marks: 80

Objective Part Compulsory

Q.NO.1:-Answer the following questions in 2-3 lines having 2 marks each

I. Differentiate among source code, intermediate code and object code?

2. What are the main components of context-free grammar.

S/Define lexical analyzer

4. Define canonical-LR

5. What is the Predictive Parsing

6 Define Three-Address Code

7 What are the Lexical Errors

& What type of errors the lexical analyzer report? Support your answer with example.

2 Where the produced tokens will be kept during lexical phase also discuss, how to create lexemes.

L0. Discuss any two functions of pre-processor?

L. Differentiate among compiler, language translator and cross compiler?

12. Write down the Principles of Compilation

13. Differentiate between Register allocation, and Register assignment

ustadni.co

J4. Deline Dead Code Elimination

15. Explain retargetable compiler

• 16 Define Peephole optimization

32 marks

Subjective Part

Note: Attempt any four Questions. All carry equal marks

[12x4=48]

Q. No.2.

a) Define and Explain intermediate code generation and their representation techniques in detail.

b) Explain predictive parser algorithm with the help of an example and also write grammar for it.

Q.No.ta) Write a CFG and then draw a parse tree for the following expression. ((4-8)*2(7*4)

b. Briefly explain The Structure of a Compiler.

Q.No.4 Construct a syntax-directed translation scheme that translates arithmetic expressions from

postfix notation into infix notation. Give annotated parse trees for the inputs 95-2* and 952*-.

QNo.5 Construct the minimum-state DFA's for the following regular expressions:

a) (alb)*a(alb).

b) (alb) *a(alb) (alb).

c) (alb)*a(alb)(alb) (alb)

Q. No.6. Construct the DAG and identify the value numbers for the sub expressions of the following

US expressions. assuming + associates from the left.

a) a+b+(a+b).

US

0) a + b + a + b

c) ata+((a+a+a+(ata+a+a)).

ustadni.com

Q. No.7. Translate the arithmetic expression a + -(b +

c) into:

a) A syntax tree.

b) Quadruples.

c) Triples.

d) Indirect triples.

visit website: ustadni.com