07 rr320504 language processors

9
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications USA-UK-Australia-Germany-France-NewZealand Universities List Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information www.andhracolleges.c om The Complete Information About Colleges in Andhra Pradesh www.andhracolleges.com Code No: RR320504 Set No. 1 III B.Tech II Seme ste r Regular Examinati ons , Apr/ Ma y 2007 LANGUAGE PROCESSORS (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks 1. (a) Draw a state di agra m for a nite automaton to recognize a token ty pe named ‘real constant’ This token consists of a string of digits that contains a decimal poin t.Th er e must be at least one di git before the decimal poin t. [6 ] (b) Select a high- lev el prog ramming language with which you are familiar and write code to recognize the above construct. [5] (c) What kinds of source program errors w ould be detected during lexical anal ysis? [5] 2. (a) Explai n the reasons for separating lexia l analy sis phase from synta x analy sis. [6] (b) Eliminate ambigui ties from the following grammar S iEtSeS|iEtS|a E b|c|d [10] 3. (a) Explai n in detail how an L-a ttri buted grammer can be conv erte d into a trans- lator scheme. (b) Give the transla te scheme to conver t an expression grammer into three address code. [8+8] 4. Write type expression for the followin g types (a) An arra y of pointers to real, where the arra y 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) F unctions whose domains are functions from integ ers to pointers to integers and who se ra nge s are records cons is ti ng of an integer and a character. [6] 5. (a) Write detailed notes on the symbol table mechanism using tree data structure. [8] (b) Explai n with an example about the symbol table mechanism using has h table data structures. [8] 6. (a) Explai n with an example th e abstr act mac hine code form of Intermediate code. [8] (b) Give a detailed account on loop optimisation techniques. [8] 1 of 2

Upload: andhracolleges

Post on 30-May-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 1/8

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

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

www.andhracolleges.com

Code No: RR320504 Set No. 1

III B.Tech II Semester Regular Examinations, Apr/May 2007LANGUAGE PROCESSORS

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Draw a state diagram for a finite automaton to recognize a token type named‘real constant’ This token consists of a string of digits that contains a decimalpoint.There must be at least one digit before the decimal point. [6]

(b) Select a high-

level programming language with which you are familiar andwrite code to recognize the above construct. [5]

(c) What kinds of source program errors would be detected during lexical analysis?[5]

2. (a) Explain the reasons for separating lexial analysis phase from syntax analysis.[6]

(b) Eliminate ambiguities from the following grammarS → iEtSeS|iEtS|aE → b|c|d [10]

3. (a) Explain in detail how an L-attributed grammer can be converted into a trans-lator scheme.

(b) Give the translate scheme to convert an expression grammer into three addresscode. [8+8]

4. Write type expression for the following types

(a) An array of pointers to real, where the arrayindex 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 integersand whose ranges are records consisting of an integer and a character. [6]

5. (a) Write detailed notes on the symbol table mechanism using tree data structure.[8]

(b) Explain with an example about the symbol table mechanism using hash tabledata structures. [8]

6. (a) Explain with an example the abstract machine code form of Intermediate code.[8]

(b) Give a detailed account on loop optimisation techniques. [8]

1 of 2

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 2/8

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

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

www.andhracolleges.com

Code No: RR320504 Set No. 1

7. (a) What are the application of du-and ud. [8]

(b) Compare the various forms of three address code. [8]

8. (a) Write the features of Assembly Language programming. [6]

(b) Write the general format of an Assembly language statement. [5]

(c) Explain the 3 kinds of statements of an assembly program. [5]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 3/8

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

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

www.andhracolleges.com

Code No: RR320504 Set No. 2

III B.Tech II Semester Regular Examinations, Apr/May 2007LANGUAGE PROCESSORS

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. (a) What are the basic functions of language translator. [10]

(b) Distinguish pass and phase of a compiler. [6]

2. (a) Eliminate ambiguity if any from the following grammar for boolean expres-sions.bexpr → bexpr or bterm|btermbterm → bterm and bfactor|bfactorbfactor → nst factor|(bexpr)|true|false.

Where or, and, not (, ), true, false are terminals in the grammar. [8]

(b) Write a recursion discent parser for the above grammar. [8]

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

(b) Explain the steps involved in converting an L-attributed grammar into trans-

lator scheme. [6+10]4. (a) Which of the following recursive type expressions are equivalent ? Justify your

answer?e1 = integer → e1 e2 = integer →(integer → e2) e3 = integer →( integer →e1). [8]

(b) Suppose that the type of each identifier is a sub range of integers for expressionswith the operators +, -,* , div and mod as in pascal. Write type? checkingrules that assign to each sub expression, the sub range its value must lie in.[8]

5. (a) What are self-organizing lists. How this can be used to organize a symboltable. Explain with an example. [8]

(b) Explain the process of organizing a symbol table for a block structured lan-guage. [8]

6. (a) Explain with an example the abstract machine code form of Intermediate code.[8]

(b) Give a detailed account on loop optimisation techniques. [8]

7. What is a flow graph. Explain how a given program can be converted into a flow

graph. [16]

8. (a) Explain how lexical substitution is performed for model statements by a macropreprocessor. [6]

1 of 2

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 4/8

Code No: RR320504 Set No. 2

(b) Differentiate Positional and keyword parameter. [5]

(c) How the value of the positional and keyword parameter is determined? Explainwith an example. [5]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

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

www.andhracolleges.com

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 5/8

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

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

www.andhracolleges.com

Code No: RR320504 Set No. 3

III B.Tech II Semester Regular Examinations, Apr/May 2007LANGUAGE PROCESSORS

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Write a procedure for minimizing number of states of a DFA, and explain withone example. [10]

(b) What are the different translation rules of a LEX program? [6]

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

(b) List out the rules for constructing the simple precedence table for a CFG. [8]

3. (a) Explain in detail how an L-attributed grammer can be converted into a trans-lator scheme.

(b) Give the translate scheme to convert an expression grammer into three address

code. [8+8]4. (a) What is a type checker ? How does it work ? [8]

(b) Write a short notes on static and dynamic type checking. [8]

5. (a) Which data structure will be used to implement a symbol table in an efficientway? Give reasons. [8]

(b) Discuss and analyze about all the allocation strategies in run-time storageenvironment . [8]

6. (a) Explain with an example the abstract machine code form of Intermediate code.

[8]

(b) Give a detailed account on loop optimisation techniques. [8]

7. What is a flow graph. Explain how a given program can be converted into a flowgraph. [16]

8. (a) How are constants defined in an assembly program? Explain with an example.[8]

(b) What is meant by Assembler directives? Explain the functions of the followingassembler directives. [8]

i. STARTii. ORIGIN

iii. EQU

1 of 2

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 6/8

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

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

www.andhracolleges.com

Code No: RR320504 Set No. 3

iv. LTORG

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 7/8

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

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

www.andhracolleges.com

Code No: RR320504 Set No. 4

III B.Tech II Semester Regular Examinations, Apr/May 2007LANGUAGE PROCESSORS

(Computer Science & Engineering)Time: 3 hours Max Marks: 80

Answer any FIVE QuestionsAll Questions carry equal marks

⋆ ⋆ ⋆ ⋆ ⋆

1. (a) Write a procedure that combines two NFAs in to a single NFA. The operationsto be performed are those of concatenation, union and closure. [10]

(b) Write a procedure that detects all extraneous states in a DFA. [6]

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

(b) List out the rules for constructing the simple precedence table for a CFG. [8]

3. Construct LALR parse table for the following grammerS → L = RS → RL → ∗R

L → idR → L

[16]

4. (a) What is type expression? Write type expression for the following types. [2]

i. A two dimensional array of integers (i.e. an array of arrays) whose rowsare indexed from 0 to 9 and whose columns are indexed from -10 to 10.

[3]

ii. Functions whose domains are functions from integers to pointers to inte-gers and whose ranges are records consisting of an integer and a character.

[3]

(b) What is type system. Discuss static and dynamic checking of types.[8]

5. (a) Explain how the symbol table space can be reused. Explain through an ex-ample. [8]

(b) Discuss various symbol table organization techniques. [8]

6. (a) Explain with an example the abstract machine code form of Intermediate code.[8]

(b) Give a detailed account on loop optimisation techniques. [8]7. (a) What are the application of du-and ud. [8]

(b) Compare the various forms of three address code. [8]

1 of 2

8/9/2019 07 Rr320504 Language Processors

http://slidepdf.com/reader/full/07-rr320504-language-processors 8/8

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications

USA-UK-Australia-Germany-France-NewZealand Universities List

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

8. Develop program specifications for the passes of a two pass assembler indicating

(a) Tables for internal use of the passes. [4]

(b) Tables to be shared between passes. [4]

(c) Inputs ( Files and Tables ) for every pass. [4]

(d) Outputs ( Files and Tables ) of every pass. [4]

⋆ ⋆ ⋆ ⋆ ⋆

2 of 2