+ All Categories
Home > Documents > 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf ·...

1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf ·...

Date post: 18-Apr-2018
Category:
Upload: vuongthu
View: 235 times
Download: 6 times
Share this document with a friend
67
1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND COMPILER DESIGN 1.1.1 Objectives and Relevance 1.1.2 Scope 1.1.3 Prerequisites 1.1.4 Syllabus i. JNTU ii. GATE iii. IES 1.1.5. Suggested Books 1.1.6 Websites 1.1.7 Experts Details 1.1.8 Journals 1.1.9 Recent Findings and Developments 1.1.10 Session Plan 1.1.11 Tutorial Plan 1.1.12 Student Seminar Topics 1.1.13 Question Bank i. JNTU ii. GATE iii. IES
Transcript
Page 1: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1. SUBJECTWISE DETAILS

1.1 AUTOMATA AND COMPILER DESIGN

1.1.1 Objectives and Relevance

1.1.2 Scope

1.1.3 Prerequisites

1.1.4 Syllabus

i. JNTU

ii. GATE

iii. IES

1.1.5. Suggested Books

1.1.6 Websites

1.1.7 Experts Details

1.1.8 Journals

1.1.9 Recent Findings and Developments

1.1.10 Session Plan

1.1.11 Tutorial Plan

1.1.12 Student Seminar Topics

1.1.13 Question Bank

i. JNTU

ii. GATE

iii. IES

Page 2: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability
Page 3: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1.1.1 OBJECTIVES AND RELEVANCE

The theoretical foundations of computer science have expanded substantially in recent years. The objective of this course is to introduce students to this fundamental area of computer science, which enables students to focus on the study of abstract models of computation. These abstract models allow the students to assess via formal reasoning what could be achieved through computing when they are using it to solve problems in science and engineering. The course exposes students to the computability theory, as well as to the complexity theory. The goal is to allow them to answer fundamental questions about problems, such as whether they can or not be computed, and if they can, how efficiently.

The course introduces basic computation models and their properties, and the necessary mathematical techniques to prove more advanced attributes of these models. The students will be able to express computer science problems as mathematical statements and to formulate proofs. Upon completion of this course the students are expected to become proficient in key topics of theory of computation, and to have the opportunity to explore the current topics in this area.

The theory of formal languages and theoretical foundations of computer science, find their applications in areas like Program Verification, Cryptography, Distributed Computing, Mathematical Logic in Computer Science, Models and Logics for Reactive Systems, Semantics of Computation, compiling techniques, robotics, artificial intelligence and knowledge, complexity analysis, Systems Biology, Verifying correctness of circuits and protocols.

1.1.2 SCOPE

The purpose of this course is to acquaint the student with an overview of the theoretical foundations of computer science from the perspective of formal languages and design of compilers .

"Computer Science is a cluster of related scientific and engineering disciplines concerned with the study and application of computations. These disciplines range from the pure and basic scientific discipline concerned with the foundations (or theory) of computer science (or of computation) to engineering disciplines concerned with specific applications."

The growing importance of this research area is motivated not only by industrial concerns, but has a very solid scientific basis. Indeed, in Computer Science we build artifacts---implemented in hardware, software or, as is the case in the fast-growing area of embedded and interactive systems, using a combination of both---that are supposed to offer some well defined services to their users. Since these computing systems are deployed in very large numbers, and often control crucial, if not safety critical, industrial processes, it is vital that they correctly implement the specification of their intended behavior. The problem of ascertaining whether a computing system does indeed offer the behavior described by its specification is called the correctness problem, and is one of the most fundamental problems in Computer Science. The field of Computer Science that studies languages for the description of (models of) computer systems and their specifications, and (possibly automated) methods for establishing the correctness of systems with respect to their specifications is called (algorithmic) formal verification.

The theory of computation can be sub-divided into numerous overlapping areas, and one of the main beauties of this scientific area is the unexpected interplay amongst these. Two main clusters of areas are complexity theory and algorithms. Examples of other related fields include Algorithmic Program Verification, Cryptography, Distributed Computing, and Mathematical Logic in Computer Science, Models and Logics for Reactive Systems, Semantics of Computation, compiling techniques, robotics, artificial intelligence and knowledge and Systems Biology. The emphasis in all of these areas is on the study of computational phenomena based on rigorous mathematical foundations.

1.1.3 PREREQUISITES

Page 4: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

This course requires knowledge in mathematical preliminaries likes: sets, relations, functions, graphs, strings and principles of mathematical induction and knowledge about compilers operation.

Page 5: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1.1.4.i SYLLABUS – JNTU

UNIT – I

OBJECTIVE

The main aim of this unit is to know the fundamentals of this subject, and definitions of different terms coming in this subject, and also the introduction for Finite automata and basic type of machines.

SYALLBUS

Formal Language and Regular Expressions: Languages, Definition Languages regular expressions, Finite Automata-DFA, NFA. Conversion of regular expression to NFA, NFA to DFA. Applications of Finite Automate to lexical analysis, lex tools. UNIT – IIOBJECTIVE In this unit we know the concept of context free grammars and languages. We define derivation tree, we know the methods of simplifying context free grammars. Finally about two normal forms and properties of context free language.

SYALLBUS

Context Free grammars and parsing: Context free grammars, derivation, parse trees, ambiguity LL(K) grammars and LL(1) parsing.

UNIT – IIIOBJECTIVE

In this unit we know what is an regular expression i.e as a means of representing certain subsets of strings over sigma and we conclude that regular sets are precisely those accepted by finite automata. We know the closure properties of regular sets. Finally we can understand the relation ship between regular set and regular grammar.And also , we know the concept of grammar formalism i.e (about different grammars like right and left) and equivalence between regular grammar and finite automata. Finally we have introduction to context free grammar, derivation tree etc.

SYALLBUS

Bottom up parsing handle pruning LR Grammar Parsing. LALR parsing, parsing ambiguous grammars, YACC programming specification.

UNIT – IVOBJECTIVE

In this unit we know the concept of grammar formalism ,their syntax translation this unit also gives the concept of intermediate code generation by using symbol tables and also translation of various statements like control flow statements.

SYALLBUS

Semantics: Syntax directed translation, S-attributed and L-attributed grammars, Intermediate code – abstract syntax tree, translation of simple statements and control flow statements.

Page 6: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

UNIT – V OBJECTIVE

In this unit we know about Chomsky hierarchy. We construct a automata called liner bounded automata and concept of LR(0) grammar and decidability problems in Turing machine and also we study different type expressions and overloading functions and operations

SYALLBUS

Context Sensitive features – Chomsky hierarchy of languages and recognizers. Type checking, type conversions, equivalence of type expressions, overloading of functions and operations.

UNIT – VI OBJECTIVE

In this unit we learn ,storage allocation for various data items of a procedure defined for a problem statement . Basic approach followed is dynamic(Run time) is followed. SYALLBUS

Run time storage: Storage organization, storage allocation strategies scope access to now local names, parameters, language facilities for dynamics storage allocatin.

UNIT – VIIOBJECTIVE

In this unit we have introduction of code optimization approach. Different optimization mechanisms are also studied. Different flow diagrams for data and control statements are also studied

SYALLBUS

Code Optimization: Principal sources of optimization, optimization of basic blocks, peephole optimization, flow graphs, Data flow analysis of flow graphs.

UNIT – VIIIOBJECTIVE

In this unit we learn the code generation techniques . different types of code generations studied in this unit are machine dependent , generic code etc. After completion of this unit student gets the concept of how a object code for a program of a particular language is generated

SYALLBUS

Code generation: Machine dependent code generation, object code forms, generic code generation algorithm, Register allocation and assignment. Using DAG representation of Block.

1.1.4.ii. SYLLABUS - GATE

UNIT-IFinite Automata

UNIT-IIContext free languages

UNIT-III

Page 7: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

Parsing techniques

UNIT-IVAttributed grammars

UNIT-VChomsky languages and recognizers

UNIT-VIRun time storage allocation

UNIT-VIICode Optimization

UNIT-VIIICode generation

1.1.4.iii SYLLABUS – IES

Not applicable.

1.1.5 SUGGESTED BOOKS

TEXT BOOKS

T1 Introduction to Theory of Computation – Sipser 2nd edition Thomson

T2. Compilers and Principles , Techniques and tools – Aho , ullman , Revesethi – pearson Edu.

T3 Introduction to Automata Theory, Languages and Computation, Jhon E. Hopcroft, Jefferg D. Ulman

T4 Introduction to Computer Theory, II Edition Danicl I.A. Cohen.

T5 Compilers Principles, Techniques and Tools, Alfred V.Aho, Ravi Sethi, Jeffery D.lman LPE.

T6 Theory and Practice of Compiler Writing, BS Publications, Jean-Paul Trumblay, Paul G.Sorenson.

REFERENCES BOOKS

R1. Modern compiler construction in C , Andrew w. Apple Cambridge Univ. PressR2. Compiler construction Louden , Thompson

1.1.6 WEBSITES

1. www.ieeeexplore.ieee.org2. www.acm.org/dl3. www.cs.vu.nl4. www.cs.unm.edu5. www.people.westminstrcolleg.eud6. www.doi.ieeecomputersociety.org7. www.mitpressjournal.com8. www.deloreie.com/gnu/docs9. www.compilerconnection.com

Page 8: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

10. www.cse.lehigh.edu/~cheng/

Page 9: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1.1.7 EXPERT DETAILS

REGIONAL

1. Name : OB Venkata Ramanaiah Designation : Assistant ProfessorDepartment : Dept. of Computer ScienceAddress : JNTU, Kukatpally

Hyderabad.Phone : 040-23158661 to 23158664E-Mail : [email protected] , [email protected]

2. Name : G.Vijaya KumariDesignation : Assistant ProfessorDepartment : Dept. of Computer ScienceAddress : JNTU, Kukatpally

Hyderabad.Phone : 040-23158661 to 23158664E-Mail : [email protected] , [email protected]

3. Name : Madhu Mutyam Designation : Assistant Professor

Department : International Institute of Information Technology Address : Gachibowli Hyderabad 500032 Phone : 91-40-23001967 Ext: 177 E-mail : [email protected]

NATIONAL

1. Name : Prof. Mrs Priya ChandranDesignation : ProfessorDepartment : Computer ScienceAddress : National Institute of Technology CalicutPhone : +91 495 2286804Email : [email protected]

2. Name : Mr. Murali krishnan KDesignation : LecturerDepartment : National Institute of Technology CalicutPhone : +91 495 2286660Email : [email protected]

3. Name : Dr. Sanjay Kumar Jena, Professor Designation : ProfessorDepartment : Department of Computer Science & Engineering, Address : Qr. No: D-24, NIT Campus, Rourkela-769008

Phone : 0661-2462352 Email : skjena

INTERNATIONAL

1. Name : John E.HopcroftDesignation : DeanDepartment : Engineering Professor of Computer Science

Page 10: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

Address : 4130 Upson Hal Cornell Univerity, Ithaca, NY 1453-7501.

Phone : 607-255-7316 E-mail : [email protected]

2. Name : Jeffrey D.UllmanDesignation : Professor at Stanford UniversityDepartment : Computer ScienceAddress : Stanford W.AschermanPhone : 650-725-4802 E-mail : [email protected]

3. Name : Pascal Weil LabriDésignation : ProfessorDepartment : Université Bordeaux IAdresse : 351 cours de la Libération

33405 Talence Cedex, France.Phone : +33 5 40 00 69 28E-mail : [email protected].

1.1.8 JOURNALS

1. Name of the Journal : Journal of Artificial Intelligence Research (JAIR)Publisher : Association for computing Machinery (ACM)

2. Name of the Journal : Journal of Machine Learning Research (JMLR)Publisher : Springer Netherlands Publications

3. Name of the Journal : Journal of American Society for Information Science and Technology (JASIST)

Publisher : Inder Science Publications

4. Name of the Journal : Journal of Intelligent Information Systems(JIIS)Publisher : Springer USA Publications

5. Name of the Journal : ACM Transactions on Information Systems(TOIS)Publisher : Springer Boston Publications

6. Name of the Journal : ACM Transactions of Internet Systems (TOIS)Publisher : Acta Informatic Publications

7. Name of the Journal : ACM Transactions on Programming Languages and SystemsPublisher : Springer Berlin Publications

8. Name of the Journal : International Journal of Intelligent SystemsPublisher : Acta Informatic Springer Berlian Publications

9. Name of the Journal : International Journal of Digital LibrariesPublisher : Beijing Publisher China

10. Name of the Journal : Journal of DocumentationPublisher : Springer Netherlands Publications

11. Name of the Journal : Journal of Intelligent Systems

Page 11: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

Publisher : Springer Boston Publications

12. Name of the Journal : Computational LinguisticsPublisher : Inder Science Publications

Page 12: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

7.1.9 RECENT FINDING AND DEVELOPMENTS

1. Title : Computing optional description for optimality theorygrammars

With context free position structuresAuthor : Bruce TesarJournal : Association for computational LinguisticsYear, Vol. & Page No. : 1996, vol. 211, 101-107

2. Title : Lower bounds on information transfer in distributed comutations

Author : H.AdersonJournal : IEEE symp foundations of Computer ScienceYear, Vol. & Page No. : 1978, vol.299, 151-158

3. Title : A family of NFA’s which need 2n-Deterministic statesAuthor : Kazuolwana, Akiniro, Masuuva, MikapatersonJournal : Elsevier Science Publications Ltd.Year, Vol. & Page No. : 2003, vol.301, 451-462

4. Title : The parallel complexity of simple logic programs,Author : Foto Afrati, Chritos H.PapadimitriouJournal : Acm press New York,Ny, USAYear, Vol. & Page No. : 1978, vol.40, 891-916

5. Title : DNA computing by blockingAuthor : G.Rozenberg, H.Sppairk,Journal : Elsevierscience publisher ltdYear, Vol. & Page No. : 2003, vol. 292, 653-665

Page 13: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1.1.10 SESSION PLAN

S.NoTopics covered in JNTU syllabus

Modules and Sub modulesNo. of

LecturesSuggested Books Remarks

UNIT – I – FORMAL LANGUAGE & REGULAR EXPRESSIONS (No. of Lectures – 9)

1 Languages

DefinitionL1 L2

T4-Ch1 (P:7-12)T6-Ch1 (P:1-4)T6-Ch3 (P:68-87)R1-Ch1 (P:7-12)

GATE

Introduction to Defining LanguageKleene closure exams

2Definition Languages Regular Expression

Formal Definition L3T1-Ch1(P:63-66)T6-Ch3 (P:151-155)R1-Ch1 (P:18-21)

3 Finit Automata – DFA, NFA

Formal Definition L4 T1-Ch1(P:31-56)T3-Ch2(P:51-70)T6-Ch4(P:156-165)R1-Ch1(P:21-23)

Designating, Examples L5

4Conversion of Regular Expression to NFA

Condition and Examples L6

T2-Ch3(P:99-103)T3-Ch3(P:97-99)T6-Ch4(P:166-168)R1-Ch1(P:25-27)

5 NFA to DFA Condition and Examples L7T2-Ch3(P:96-99)T6-Ch4(P:170-177)R1-Ch1(P:27-30)

6Applications of Finit Automata to Lexical Analysis

Lexical Analyzers, Text Editors L8T3-Ch2(P:45-46)T6-Ch4(P:142-144)

7 Lex ToolsComplier constructions tools,phases

L9T5-Ch1(P:22-23)T6-Ch1(P:4-11)R1-Ch1(P:5-7)

UNIT – II – CONTEXT FREE GRAMMERS AND PARSERS(No. of Lectures – 5)

8 Context free grammars Formal definition examples L10T1-Ch2(P:101-108)T6-Ch2(P:42-49)R1-Ch3(P:41-43)

GATE

9 Derivations Trees L11T2-Ch4(P:134-140)T6-Ch2(P:35-36)R1-Ch3(P:42-43)

10 Parse Trees Ambiguity L12T2-Ch4(P:138-140)T6-Ch2(P:31-34)R1-Ch3(P:43-46)

11Ambiguity LL (K) grammars, LL (1) parsing

Predictive Parsers, first and follow, constructions,

L13 L14

T2-Ch4(P:148-158)T6-Ch6(P:235-241)R1-Ch3(P:46-54)

UNIT – III BOTOM UP PARSING (No. of Lecturers – 8)

12 Botom up parsing Handling L15T2-Ch4(P:158-160)T6-Ch7(P:274-285) GATE

13 Handling parsing Parsing techniques L16 T2-Ch4(P:160-161)

14 LR grammar parsingAlgorithms, Construction of SLR, CLR parsing tables

L17 18

T2-Ch4(P:174-190)T6-Ch7(P:341-370)R1-Ch3(P:56-65)

15 LA LR Parsing Construction L19T2-Ch4(P:191-199)T6-Ch7(P:370-375)R1-Ch3(P:65-67)

16 Parsing Ambiguous grammar Special case production, L20 L21

T2-Ch4(P:199-208)R1-Ch3(P:68-69)

Page 14: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

17YACC Programming specifications

Parser generator, YACC L22T2-Ch4(P:208-216)T6-Ch3(P:177-180)R1-Ch3(P:69-70)

UNIT – IV - SEMANTICS (No. of Lectures – 5)

18 Syntax directed translationDefinitions, Synthesized, Inherited attributes, Dependency graph

L23L24

T2-Ch5(P:226-237)T5-Ch5(P:280-287)T6-Ch11(P;536-538)

19 S-attribute & L-attribute Definition, translation schemes L25T2-Ch5(P:240-244)T5-Ch5(P:293-301)

20Intermediate Code Abstract syntax tree

Conditions L26 T2-Ch5(P:240-244)T6-Ch10(P:525-527)R1-Ch4(P:92-94)

21Translation of simples statements and control flow statements

Implementation of three address code

L27T5-Ch8(P:470-473)T5-Ch8(P:504-506)T6-Ch10(P:523-525)

GATE

UNIT – V – CONTEXT SENESTIVE FEAUTURES (No. of Lectures – 4)

22Chomsky Hierarchy of languages and recognizers

Types of languages L28T3-Ch9(P:217-223)T1-Ch2(P:108-111)

GATE

23 Type CheckingType systems, Type expression, Type conversions

L29T2-Ch6(P:277-281)T5-Ch6(P:343-349)R1-Ch5(P:118-123)

24 Equivalence of type expression Structure, names cycles L30T2-Ch6(P:285-290)T5-Ch6(P:352-359)R1-Ch5(P:115-118)

25Overloading of Function & operation

Set of possible types for a sub-expression

L31 T5-Ch6(P:361-364)

UNIT – VI – RUN TIME STORAGE(No. of Lectures – 8)

26 Storage OrganizationSub-division of run time memory, activation records

L32 L33 L34

T2-Ch7(P:303-306)T6-Ch9(P:477-483)R1-Ch6(P:125-134)

27Storage allocation strategies, Scope excess to non-local names, parameters

Static allocation, stack location, dangling, references

L35 L36 L37

T5-Ch7(P:404-423)T6-Ch9(P:477-480)

28Language facilities for dynamic storage allocation

Explicit allocation of fixed sized, variable sized blocks

L38 L39

T5-Ch7(P:440-446)T6-Ch9(P:480-519)

UNIT – VII – CODE OPTIMIZATION (No. of Lectures –11)

29Principles sources of optimization

Function preserving transformation, Loop optimization

L40 L41

T2-Ch10(P:430-438)T6-Ch12(P:610-654)T5-Ch10(P:592-598)

GATE

30 Optimization of basic blocks Use of Algebraic identifiers L42T2-Ch10(P:441-444)T5-Ch10(P:598-602)

31 Peep hole optimizationRedundant loads and stores, flop control optimization

L43 L44

T2-Ch10(P:438-441)T5-Ch9(P:545-557)

32 Flow graphsDominators, natural loops, inner loops

L45T2-Ch10(P:444-449)T5-Ch12(P:660-678)T5-Ch10(P:602-608)

33 Dataflow analysis of flow graphs

Points – Definitions, structured programs , conservative estimations of data flow information, computation of in

L46 L47 L48 L49

T2-Ch10(P:449-461)T5-Ch10(P:608-620)T6-Ch12(P:655-678)T5-Ch10(P:662-670)

Page 15: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

and out L50UNIT – VIII – CODE GENERATION (No. of Lectures –11)

34Machine dependent code generation

Impel code generator, registered and address description

L51 L52 L53

T2-Ch9(P:412-416)T2-Ch9(P:371-398)T5-Ch9(P:535-541)

35 Object code formsSymbolic debugging of optimized code, effect of global optimization

L54L55

T2-Ch10(P:522-529)

36Generic Code generation Algorithm

Code generation Algorithms, Generating code from DAGs

L56L57 L58

T2-Ch9(P:403-412)T5-Ch:9(P:557-567)

37Register Allocation & Assignment

Global register Allocation L59T6-Ch13(P:686-690)T5-Ch9(P:541-546)

38Using DAG Representation of a Block

DAG Constructions & Applications

L60L61

T2-Ch9(P:398-403)T5-Ch9(P:546-554)T6-Ch12(P:620-631)

1.1.11. TUTORIAL PLAN

Sl. No

Date Topics Scheduled Salient topics to be discussed

1.03-07-08

Definition Languages Regulation Expressions

Formal Definition, Regular sets, Properties, Conversation.

2.10-07-08

Finite Automata – DFA NFA, Legs Tools

Formal Definitions, Conditions, Conversitions of NFA to DFA, Applications of Finite Automata, Facases of complier.

3.17-07-08 Context free grammars,

Notational Conventions.Derivations and Parse TreesAmbiguity

4.24-07-08 Predictive Parsing

Preprocessive steps required for Predctive parsing, Fist and Follow construction of parsing tables.

5.31-07-08 Bottom up parsing LR & SLR parsing, LALR parsing, LR grammars

6.05-08-08 YACC–Automatic parser generator

Precedence of Terminals and Productions, Implementation of LR Parsing Tables.

7.12-08-08 Syntax Directed Translation

S-attributed and L-attributed grammars, Abstract syntax tree

8.19-08-08

Translation of simples statements and control flow statements

Syntax directed translations schemes

9.09-09-08

Chomsky Hierarchy of languages and recognizers

All the types of grammars

10. 16-09-08 Type Checking

Type systems, type conversions, equivalence of type expressions, overloading of functions and operations

11. 23-09-08 Storage Organization

Storage allocation strategies, static allocation, stack allocation,

12.

30-09-08 Language facilities for dynamic storage allocation.

Explicit allocation of fixed sized, variable sized blocks, Implicit De allocation.

Page 16: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

13. 14-09-08 Consideration for Optimization

Sources of optimization, scope optimization, local optimization

14. 21-09-08 Loop Optimization, Flow Graphs

Loop Detection, Peephole optimization, Optimization in basic blocks, Data Flow analysis, structured program, General control flow.

15. 21-09-08 Object code forms

Object programsEnvironment of the code generatorProblems in code generation

16. 21-09-08 DAG for register allocation

Code generation from DAG’sA heuristic ordering for DAG’s

1.1.12 STUDENT SEMINAR TOPICS

1. Title : Descriptional complexity of finite automata Author : Juraj HromkovicJournal : Journal of Automata, Languages and combinotoricsYear, Vol. & Page No. : 2002 ,Volume 7, Issue 4,Pages 519-531

2. Title : Formal semantic for computer languages and its applications in a

compiler - complierAuthor : Foto Afrati, Chritos H.P. PapadimitriouJournal : Comm. ACM

Year, Vol. & Page No. : 1978, vol. 9:1, 3-9

3. Title : Semantics of context free languages”, math. Systems theoryAuthor : D.SeeleyJournal : Year, Vol. & Page No. : 1998, Vol. 2:2, 127-145

1. Title : The storage allocation strategiesAuthor : G.J. Simmons

Journal : Comm. ACMYear, Vol. & Page No. : 1970, vol.8:2, 111-112

5. Title : A Parser-generating system for constructing compressed compilers,

Author : H.AdersonJournal : Comm. ACMYear, Vol. & Page No. : 1988, vol. 16:11, 669-676

6. Title : TMG-Syntax directed compilerAuthor : RC HOLTJournal : ACM national conf.Year, Vol. & Page No. : 2001, vol. 12:11, 262-274

Page 17: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1.1.12 QUESTION BANK

UNIT-I1. (a) Find 2-Closure(A) and 2-Closure(C) for the Finite Automaton as shown in

Figure 3a

(b) Explain the bootstrapping process with a suitable diagram.

2. (a) What is Finite Automaton? Give an example.(b) Find the number of tokens presented in the following `FORTRAN' statements:i. DO 100 I = 1.625ii. IF ( MIN .EQ. MAX ) GOTO 1000(c) Find the Regular Expression for the DFA as shown in _gure 7c.

(a) (JNTU May 11)

3. State the steps to convert a regular expression to NFA. Explain with an example.(a) Define regular expression. Give examples(b) (b) State & explain the properties of regular sets (JNTU May 11)

4. (a) Design a DFA that accepts strings over _=f0, 1g if and only if the value ofthe string, interpreted as a binary representation of an integer is zero modulo5.

Page 18: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(b) Construct an NFA equivalent to the following Regular Expressions: (JNTU June 10)

i. 10 + (0 + 11) 0* 1ii. (a + b)* (aa + bb) (a + b)*. 2. a) Briefly explain about predictive parser. b) Let G = ({A0, A1, A2 , A3}, {a, b}, P, { A0}), where P is given by:

A0 aA0 |bA1 →A1 aA2 |aA3 →A2 a |bA1| bA3 →A3 b |bA0 →

5. Construct an NFA accepting L(G). .(JNTU JUNE10)

6. a) Write a general format of the LEX program and give an example. b) Construct a DFA that accepts an identifier of a programming language. c) Explain the difference between the phase and pass of a compiler.(JNTU JUNE10)Write short notes on following terms:

(c) NFA(d) Regular Expression(e) Transition diasgram(f) Token (JNTU June 10)

7. (a) Define DFA and NFA. Give examples.(b) Convert the following NFA to equivalent DFA: (JNTU May 09)

8 (a) Define regular expression. Give example. Write its applications. [10+6](b) Give regular expressions generating the following languages over ‡” = {0,1}(i) L1 = {w | w contains atleast three 1’s}(ii) L2 = {w | w has length at least 3 and its third symbol is 0}(iii) L3 = {w | w doesn’t contain the substring 110}(iv) L4 = {w | every odd position of w is a 1}(v) L5= {w | w contains at least two 0’s and at most one 1} (JNTU May 09)9. (a) Define finite automata and write its applications.

Page 19: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(b) Convert the following regular expressions into NFA. [6+10](i) (0 U 1)*000(0 U 1)*(ii) (((00)*(11))U01)* (JNTU May 09)(iii) ö*

10. Describe lexical analysis and lex tools. (JNTU May 09)

11. (a) What are the closers properties of regular sets? Explain. (b) Briefly explain the logical phases of a compiler model . (JNTU Nov 08)12. (a) Write a general format of the LEX program and give an example. (b) Construct a DFA that accepts an identifier of a programming language. (c ) explain the difference between the phase and pass of a compiler.

13. (a) When are two regular Expressions said to be equivalent? Explain with an example. (b)

b

bb

b a

(JNTU Nov 08)

14. (a ) Design a DFA that accept the language over the alphabet = { 0,1,2} where the decimal Equivalent of the language is divisible by 3. (b) Compare compiler and interpreter with the help of suitable example. (JNTU Nov 08)

15. For the NFA given by following state transition diagram fig 1a. Check whether the string “abbabba” is accepted or notb. Give at least two transition pathsc. Find equivalent DFA. Check for same result of bit(a) (JNTU Feb 07)

a b

a

Q0

Q2

Q1

Q3

A

B

D

C

E

Page 20: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

b

b a

b

Fig-1

16. Design a DFA accepting the language given over the alphabet {0,1}, L={the set of all strings such that every block of five consecutive contains at least two 0’s}. (JNTU Apr 05, Feb 07, Nov 06)

17. Give mathematical definition of NFA and state main differences between NFA and DFA.(JNTU Apr 05, Feb 07,

Nov 06)

18. With the help of schematic diagram explain the function of DFA. What are the reasons to say it is deterministic? (JNTU Apr 05, Nov 06)

19. For the following State transition table draw the state transition diagram. Find its equivalent machine.

For the string “abbaaab” test whether both give same result or not. q0 is initial state and q3 is the final state. (JNTU Mar 06, Nov 05, 06)

Q/∑ 0 1q0 q1 q2

q1 q1 q1q3

q2 φ φq3 q0q3 q3

20. Give DFA which reads string from {a,b} and end with aaa. (JNTU Nov 05)

21. a. Describe the languages denoted by the following regular expressions (JNTU Aug/Sep 06)i. (0+1) * 0(0+1) (0+1) [2] ii. 0*10*10*10* [2]iii. (00+11)_ ((01+10)(00+11)_ (01+10) (00+11)_ )_

b. Write a lex program that copies a file, replacing each non-null segments of white space by a single blank.

22. a. Write a procedure that combines two NFAs in to a single NFA. The operations to be performed are those of concatenation, union and closure. (JNTU Apr/May 07, 04, Aug/Sep 07)b. Write a procedure that detects all extraneous states in a DFA.

23 a. Write a procedure for constructing a deterministic finite automata from a non-deterministic Automata, explain with one example. (JNTU Apr/May 06, Aug/Sep 07, Nov 03)b. Give the general format of a LEX program.

24 a. Write about lexical analyzer generator. (JNTU Apr/May 06, Nov 05)b. Construct minimum state DFAs for the following regular expressions.

i. (a+b)* a (a+b) [3]

Page 21: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

ii. (a+b)* a (a+b) (a+b) [3]iii. (a/b)* a (a/b)(a/b)(a/b). [3]

25. a. Explain lexical analysis in detail. (JNTU Apr/May 06, Nov/Dec 05, 04, Aug/Sep 07)b. What are the reasons for separating lexical analysis from syntax analysis.

26. a. What is the role of lexical analyzer. (JNTU Nov/Dec 05, Aug/Sep 06)b. Construct an NFA for the regular expression R=(a+b)* abb convert it in to an equivalent DFA.

27 Explain with one example how LEX program perform lexical analysis for the following patterns in C : identifier, comments, numerical constants, arithmetic operators.

(JNTU Nov/Dec 05, Aug/Sep 06, Apr/May 04)

28. Construct a DFA equivalent to M={{q0,q1},{0,1},q0,{q0},δ },δ is given by the state table. (JNTU Nov 05)

State/Σ 0 1q0 q0 q1q1 q1 q0, q1

29 Minimize the FA given below and show both the given and the reduced one are equivalent(JNTU Nov 05,

Mar 06)State/Σ a bq0 q0 q3q1 q2 q5q2 q3 q4q3 q0 q5q4 q0 q6q5 q1 q4q6 q1 q3

30. Define epsilon closure. Find epsilon closures for all the states of given NFA-∈. Remove epsilons with out changing the acceptance fig 4. (JNTU Nov 05)

fig 4.

31 For the FA-∈ given check whether the string “aannanan” is accepted or not, if accepted write the transition path. Find equivalent NFA without epsilon transitions, explain the procedure

used and check the string given on your new NFA. Fig 6 (JNTU Apr 05, Nov 05)

Page 22: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

Fig 6

32.onstruct the DFA equivalent to the NFA M=({p,q,r,s},{0,1},S,P,δ ) and δ is given by.( JNTU Apr 05)

Q/∑ 0 1p p,q Pq R RR S -S S S

33.. S a S a / b S b / a / b (GATE 09) The language generated by the above grammar over the alphabet {a ,b} is the set of

a All the palondromesb All odd length palindromesc strings that begin and end with the same symbold All even length palindromes 20. Which one of

the following language over the alphabet { 0, 1 } is described by the regular expression(0+1)*0 ( 0 +1)* 0(0+1)*? (GATE 09)

a The set of the strings containing the substring 00b The set of the strings containing at most two 0’sc The set of the strings containing at least two 0’sd The set of the strings that begin and end with either 0 or 1.

34. Which one of the following is false? (GATE 09)a There is a unique minimal DFA for every Regular languageb Every NFA can be converted to an equivalent PDA.c Complement of every context free language is recursived Every non deterministic PDA can be converted to an equivalent deterministic PDA.

35. Match all items in Group-1 with correct options from those given Group-2Group-1 Group-2

P. Regular Expression 1. Syntax Analysis Q. Push Down Automata 2. Code Generator R. Data flow Analysis 3. lexical analysis S. Register Allocation 4. Code optimization a P-4,Q-1,R-2,S-3 b P-3,Q-1,R-42,S-2 c P-3,Q-41,R-,S-2 d P-2,Q-1,R-4,S-3 (GATE 09)

Page 23: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

36. Which of the following set can be recognized by Deterministic Finite State Automaton?

a. The numbers 1,2,4,8,….,2n, …….Written in binaryb. The numbers 1,2,4,……,2n,……..written in unary c. The set of binary string in which the number of zeros is the same as the number of ones.d. The set {1,101,110111,1110111,……………} (GATE 98)

37. Design a deterministic finite state automaton (using minimum number of states) that recognizes the following language L={w∈{0,1}*|w interpreted as binary number (ignoring the leading zeros) is divisible by five.

(GATE 98)

38. a. Find the number of binary string of w of length 2n with an equal number of 1’s and 0’s, and the property that every prefix and w has at least as many 0’s as 1’s.

b. Show that all vertices in an undirected finite graph can not have distinct degrees, if the graph has at least 2 vertices.

(GATE 02)

39. A simple two-pass assembler does the following in the first pass: (GATE 93)a. it allocates space for the literals.b. It computes the total length of the programc. It builds the symbol table for the symbols and their values.d. It generates code for all the load and store register instructions.e. None of the above.

40. Which of the strings 0001,01001,0000110 are accepted by the following DFA.

1 01

10

0

41. For Σ ={a,b} Construct DFA’s that accept the sets consisting ofa. all the strings with exactly one ab. all the strings with at least one ac. all strings with at least one a and followed by exactly two b’s

42 Design DFA which accepts the string 1010 only.

43 Design DFA which accepts the string 1100 or 1010 only.

44 Design DFA which accepts set of all strings containing 1010 as substring.

Q0 Q2Q1

Page 24: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

45 Design DFA which accepts set of all strings containing 0101 as substring.

46 Design DFA which accepts set of all binary strings.

47 Design DFA which accepts set of all strings ending with 00.

48 Design DFA which accepts set of all strings containing 3 consecutive 0’s.

49 Design DFA which does not accepts set of all strings containing three consecutive 0’s.

50 Build an FA that accept only those words that have even number of sub strings a,b.

51 Design a DFA which accepts set of all strings which are divisible by 5 for binary alphabet.

52 For NFA in figure find δ (q0,1010) and δ (q1,00)

0start 0,1

1

1

53 Which of the strings are accepted by the following NFA

Start 0,1 1

0 0

1a. 00b. 01001c. 10010d. 000

54 Design an NFA which accepts set of all binary strings containing 1100 or 1010 as sub strings.

55 Design an NFA which accepts set of all binary strings ending with two consecutive 0’s.

56 Design an NFA which accepts set of all binary strings containing three consecutive 0’s.

57 Design an NFA, which accepts, set of all binary strings containing the third symbol from the left end is 1 and second symbol from left end is 0.

58 Find the length of the following stringsa. |abcdef|b. |12436|c. |abcdε pk|d. let y=abc1234 then |y|=?

59 Write the prefix and suffix set of the string x=abcd

60 Write the proper prefix and proper suffix set of the string x=abcdef

Q2Q1Q0

Q0 Q2Q1

Page 25: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

61 Explain the operations on strings

62 Explain the operation of a Finite Automata.

63 Define transition system and Give the properties of transition functions

64 Draw the transition diagram for the given transition table

Q/∑ 0 1

→q1 q3 q2

q2 q1 q4

q3 q2 q1

*q4 q4 q3

65 Give the entire sequence of states for the input string 110001

Q/∑ 0 1

→*q0 q2 q1q1 q3 q0q2 q0 q3q3 q1 q2

66 Define Language. State and Explain the Operation on the Language.

67 State whether the Automaton given below accepts the string “1100001”.

UNIT – II

1 (a) Test whether the following grammar is LL(1) or not.S ! AaAb jBbBaA ! 2B !2(b) Construct the predictive parse table for the following grammar:S ! AA ! aB jAdB ! bBC jf

(g) C ! g.(JNTU May 11)

2. (a) Draw the parse tree for an expression: a_ - ( b + c )(b) Give the Context Free Grammar(CFG) that generates the set f0 to f1ay 11)

3 Construct the predictive parse table for the following grammar:S ! iEtSS0 jaS0 ! eS j2E ! b. (JNTU June 10)

1. (a) Find the precedence functions for the following grammar: E->E+E/E*E/(E)/id

Page 26: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(b) What is the significance of lookahead symbol in parsing process. (JNTU June 10)4Write a short note on following terms:

(a) Derivation(b) Ambiguity(c) Parse tree(d) LL (k) grammar (JNTU June 10)

5. (a) “ The top down parsing is also considered as LMD derivation” justify the statement. (b) Verify whether string ‘id+(id+id)” is accepted by following grammar or not by using predictive parsing:

E->TEE->+TE/T->FTT->*FT/

F->(E)/id (JNTU June 10)

6Describe LL(1) parsing. (JNTU May 09)7Explain ambiguous grammar and LL(K) grammar. (JNTU May 09)8 (a) Describe parse trees. (JNTU May 09)(b) Describe LL(1) parsing.9a) Describe Context Free Grammar.b) Generate CFG to the following finite automaton: (JNTU May 09)

10. ute the FIRST and FOLLOW sets of each of the non –terminal for the following grammar.

P AQRbe / mn/ DeiA ab / ^Q q1q2/^R r1r2/^D d

E e. (JNTU Nov 08)

11.a) What is a recursive grammar? Explain(b) Consider the following recursive grammar:

S Aa/bA Ac/Sd

What is an equivalent grammar when the left recursion is removed? (JNTU Nov 08)

Page 27: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

12 (a) Give the CFG generating the set of palindromes over an alphabet(b) Consider the following recursive grammar : S Sa/Sb/ a/bObtain an equivalent grammar with NO left recursion. (JNTU N0v 08)

13.Construct a Predictive parser table for the following grammar. (JNTU Nov 08)E->E+T/T T->T*F/FF->(E) /xy/xz

14a.Explain the reasons for separating lexical analysis phase from syntax analysis.b. Eliminate ambiguities from the following grammar

S ! iEtSeS|iEtS|aE ! b|c|d (JNTU Apr/May 07, 06, Nov/Dec 05, Aug/Sep 07, Apr 03)

15a.Eliminate ambiguity if any from the following grammar for Boolean expressions. 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.

b. Write a recursion discent parser for the above grammar. (JNTU Apr/May 07)

16 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 parser succeeds. (JNTU Apr/May 07, Apr 03

b. List out the rules for constructing the simple precedence table for a CFG.

17 a. Convert the following grammar into LL(1) grammarR ! R“|'R|RR|R _ |(R)|a|b [10] (JNTU Apr/May 06, 04)

b. What are the advantages and disadvantages of operator precedence parsing.

18 a. The grammar S ! aSa|aa generates all even length strings of a’s except for the empty string-show that the brute force method of top down parsing succeeds of 2,4 and 8a’s but fails on 6a’s. Also find out what are the even strings that are passed by the technique.

b. What is an LL(1) grammar. Can you convert every context free grammar into LL(1).

(JNTU Apr/May 04, 03)

19 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 parser is used, it succeeds of 2a’s, 4a’s, 8a’s but fails on 6a’s. Find out all even strings for which the parser succeeds. (JNTU Nov/Dec 05)

b. List out the rules for constructing the simple precedence table for a CFG.

20 a. Convert the following grammar into LL(1) grammarR ! R“|0R|RR|R _ |(R)|a|b [10] (JNTU Aug/Sep 06, Nov 05)

b. What are the advantages and disadvantages of operator precedence parsing.

21 a. Eliminate ambiguity if any from the following grammar for Boolean expressions.(JNTU Aug/Sep 06)

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.

Page 28: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

b. Write a recursion discent parser for the above grammar.

22 . Eliminate ambiguities in the following grammar. (JNTU Aug/Sep 06, 07, Apr/May 05, 04)S ! iEtS|iEtSeS|a E ! b|c|d where a,b,c,d,e,i,t are trminals.

b. Construct operator precedence parse table for the above grammer.

23Generate parse tree for the following grammarE->E+EE->E*EE->id

24 Find the reduced grammar equivalent to CFGG=({S,A,B,C}{a,b,d},S,P)

25 Consider following gremar and obtain an equivalent grammar containing no useless grammar symbols.A->xyz/XyzzX->Xz/xYxY->yYy/XZZ->Zy/z

26Find the reduced grammar that is equivalent to the CFG given below:S->aC/SBA->bSCaB->aSB/bBCC->aBC/ad

27Given the grammar shown below ,eliminate all the unit productions from the grammarS->ABA->aB->C/bC->DD->EE->a

28 Consider the following grammar, and eliminate Left recursion from the GrammarS->AA->Ad/Ae/aB/aCB->bBC/fC->g

29 Consider the following grammar, and eliminate Left recursion from the GrammarS->(L)/aL->L,S/S

30Test whether the following grammar is ambiguous.L->L;L/Ss->a

31Differentiate left linear grammar and right linear grammar

32 Write a CFG to specify the declarations in C(ie basic data type, array declaration

33. Explain regular set and regular expression

34. Define Backtracking and LL(1) parser

Page 29: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

35. Test whether the given grammar is LL(1) or not , and Construct a predictive parsing table for it.S->AaAb/BbBaA->εB-> ε

36. Construct the given grammar and test whether grammar is LL(1) or not .S->1AB/ εA->1AC/0CB->0SC->1

37 Construct a Predictive parsing table for the following grammar where S/ is a start symbol and # is the end marker.S/->S#S->qABCA->a/bbDB->a/ εC->b/ εD->c/ ε

38 Construct a predictive parser table for the following grammarS->AA->aB/AdB->bBC/fC->g

39 Construct a predictive parser table for the following grammar, Where S is a start symbol.S->iEtSS1/aS1->eS/ ε, E->b

40. Construct LL(1) parsing table for the following grammarS->aBDhB->cCC->bC/ εD->EFE->g/ εF->f/ ε

41 Compute the FIRST and FOLLOW sets for each non terminal of the grammar given below:S->ABa/bCaA->cBCD/ εB->CdA/adC->eC/ εD->bSf/a

42 Test whether the following grammar is LL(1);S->AB/eDaB->ab/cB->dCC->ec/ εD->fD/ ε

43 Every unambiguous grammar is LL(1).Comment on the truth/false-hood of the statement.

44 Construct LL(1)parse table for the follwing grammar:S->aAC/bB

Page 30: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

A->eDD->bE/ εE->eD/dDB->f/gC->h/i

45. Transform the following grammar so that it will be LL(1),without changing the languageS->aAC/bBA->Abc/Abd/eB->f/gC->h/i

46. Consider the following grammarS->aA/ABA->Ab/cB->e/f

47 Design LL(1) parse table for the following grammar.S->aAcd/BCeA->b/ εB->Cf/, C->fe

48 Construct the LL(1) table for the following grammar.1. Expr->_Expr2. Expr->(Expr)3. Expr->Var Expr Tail4. ExprTail->_Expr5. ExprTail->^6. Var ->id Var Tail7. VarTail->(Expr)8. VarTail->^9. Goal->Expr$

49 “There may exist a grammar that is non LL(1)but generating an LL(1)language”. Comment on the truth/false-hood of the statement.

50. a. Define LL(1) grammar. b. Construct LL(1) parse table for the following grammar.

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

51 a. Define LL(1) grammar.b. Construct LL(1)parse table fr the following grammar

S->Aa/bAc/Bc/bBaA->dB->d

52 Is the following language LL(1){an cbn/n≥1}20 “there may exist a grammar that is non LL(1)but generating an LL(1)language”. Comment on the truth/false-hood of the statement.

53. Find the reduced grammar equivalent to CFGG=({S,A,B,C}{a,b,d},S,P)

Page 31: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

54. Consider the grammar with non terminals N= { S, C, S1},terminals T= {a,b, i,t,e} with S as the startSymbol, and the following set of rules.

S ---- > iCtSS1/cS1----- > eS /null

The Grammar is not LL(1) because:a. It is left recursive b. it is right recursiveC it is ambiguous d. it is not context –free (GATE 07)

55. Consider the following two statements:P: Every regular grammar is LL(1)Q:Every regular set has a LR(1) grammarWhich of the following is true?a. Both P and q are true b. P is true and Q is falseb. P is false and Q is true d. both P and Q are false

(GATE 07)56 . Statement for Linked Answer Questions 61 to 62 (GATE 07)

Consider the CFG with {S,A,B} as the non terminal alphabet, {a,b}as the terminal output S as start symbol and the following set of production rules:S ---- > aB S ---- > bAB ----> b A -----> aB ----> bS A -----> aSB -----> aBB A -----> bAA

57. Which of the following strings is generated by the grammar?a. aaaabb b. aabbbb c.aabbab d.abbbba

58. Consider the following grammar: (GATE 06)S->FRR->*S/€F->idIn the predictive parser table ,M, of the grammar the entries M[s,id] and M[R,$] respectively

a. { S->FR} and {R-> €}b. { S->FR} and{}c. {S->FR} and {R->*S}d. {F->id} and {R->€}

59. Consider the following grammar. (GATE 06)S->S+ES->EE->F+EE->FF->idConsider the following LR(0) items corresponding to the grammar above.

i. S->S*Eii. E->F.+Eiii. E->F+.E

given the items above ,which two of them will appear in the same set in the canonical sets –of-items for the grammar?

a. i) and(ii)b. (ii) and (iii)c. (i) and (iii)d. None of the above

Page 32: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

60. The grammar A->AA/(A)/ € is not suitable for predictive parsing because the grammar is (GATE 05)

(a) ambiguous (b) left –recursive(c) right recursive (d) an operator grammar

61. The grammar A->AA/(A)/ € is not suitable for predictive parsing because the grammar is (GATE 05)

(a) ambigious (b) left –recursive(c) right recursive (d) an operator grammar

62. Construct the LL(1) table for the following grammar. (GATE 95)1. Expr->_Expr2. Expr->(Expr)3. Expr->Var Expr Tail4. ExprTail->_Expr5. ExprTail->^6. Var ->id Var Tail7. VarTail->(Expr)8. VarTail->^9. Goal->Expr$

63. Which of the following features cannot be captured by context-free grammars? (GATE 94)a. syntax of if-then-else statementsb. syntax of recursive proceduresc. whether a variable has been declared before its used. variable names of arbitrary length

64 For the Context free grammar ,FOLLOW(A) is the set of terminals that can appear immediately to the right of non –terminal A in some “sentential” form. We define two sets LFOLLOW(A) and RFOLLOW(A) by replacing the word “sentential” by left sentential “ and “right most sentential” respectively in the definition of FOLLOW(A).Which of the following statements is/ are true ? (GATE 92)

a. FOLLOW(A) and FOLLOW(A) may be different.b. FOLLOW(A) and FOOLOW(A) are always same.c. All the three sets are identical.d. All the three sets are different

65. .For the correct answer string to Q. 60, how many derivation trees are there?a. 1 b. 2 c. 3 d. 4

66. Indicate all the true statements from the following: (GATE 91)a. Recursive decent parsing cannot be used for with left recursion.b. The intermediate form the representing expressions which is best suited for code optimization is

the best fix form.c. A programming language not supporting either recursion or pointer type does not need the

support of Dynamic memory allocation .d. Although C does not support call by name parameter passing ,the effect can be correctly simulated in ce. No feature of Pascal violates strong typing in Pascal

Page 33: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

67. .“There may exist a grammar that is non LL(1)but generating an LL(1)language”. Comment on the truth/false-hood of the statement.

UNIT – III

1. Describe, in detail, an operator precedence parsing with an example.2. Build the LALR parsing table for the following grammar:E ! E + TjTT ! TFjF

(h) F ! F_ jaj b: (JNTU May 11)

3. Construct SLR parsing table for following grammar:E ! E + T=TT ! T _ F=FF ! (E)=id. (JNTU June 10)

4. (a) What is LR parser? Compare and contrast the di_erent types of LR parsers.(b) Construct the CLR parse table for the following augmented grammar:A0 ! AA ! (A) ja (JNTU June 10)

5. Consider the following grammar: A` A →A (A) |a →

a) Construct the LR(0) parser. b) Find the SLR(1) parse table. c) Find the moves made by the LR(0) parser on the input string: ( ( a ) ). (JNTU JUNE10)

6. Explain Bottom up parsing with example. (JNTU May 09)7 (a) What is handle pruning? Explain(b) Describe about LR grammars. (JNTU May 09)8. Describe LALR parsing with example. (JNTU May 09)9. a) Explain ambiguous grammars.b) Describe about YACC. (JNTU May 09)

10. Consider the following augmented grammar: S-> E

E E+T T a/(E)

(a) Construct the DFA whose states are the canonical collection of LR(0) items.(b) Construct the SLR(1) parse table. (JNTU Nov 08)

11. Consider the following grammar: S1 S

S (S) S/^ (a) Construct the LR( 0 ) parser. (b ) Find the SLR (1) parse table.

Page 34: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(c ) Find the moves made by the LR( 0) parser on the input string:: ( ( ) ( ) ).12. Consider the following grammar :

E->E+T/T T->T*F/FF->(E) /a

(a) Construct the SLR parse table . (b) Find the moves made by the parser on the input string : a + a * a. (JNTU N0v 08)13. (a) what is LR parser ? Compare and Contrast the different types of Lr parser. (b) Construct the CLR parse table for the following augmented grammar::

A1 AA ( A ) /a (JNTU Nov 08)

14. Construct LALR parse table for the following grammer (JNTU Apr/May 07, 06, 04, Aug/Sep 07)S ! L = RS ! RL ! _RL ! idR ! L

15. Construct canonical LR pars table for the following grammar. (JNTU Apr/May 06, Nov/Dec 05, 04)S→L=RS→RL→*RR→L

16. a. What is an SLR grammar (JNTU Apr/May 06)b. Construct LALR(1) parse table for the following grammar for

S ->Aa|bAc|Bc|bBaA ! dB ! d .

17. Explain the algorithm for translator of S-attributed grammars along with bottom up parsing with suitable examples.

18. Construct LALR parse table for the following grammar (JNTU Aug/Sep 06, Apr/May 04)S ! Aa|bAc|Bc|bBaA ! dB ! d.

19. a. Define LR(0) grammar. (JNTU Aug/Sep 06, 07, Apr/May 05, 04)b. Construct SLR passing table for the following grammar.

E ! E + T/TT ! TF/FF ! F*|a|b.

20. a. Suppose the declaration are generated by the following grammar(JNTU Aug/Sep 06, Apr 03)D!idLL!,idL/:TT!integer/realConstruct a translation scheme to enter the type of each identifier into the symbol table.

b. Explain the translator process using the following example id, id: real.

21. a. Define LR(0) grammar. (JNTU Aug/Sep 06, Nov 05)

Page 35: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

b. Construct SLR passing table for the following grammar. E ! E + T/TT ! TF/FF ! F_|a|b.

22. a. Construct the SLR parse table for the following grammar.S->Aa/bAc/dc/bda (JNTU Aug/Sep 07)A->d

b. Distinguish SLR ,LALR grammar

23. a. What is an LR(0) grammar. (JNTU Apr/May 05)b. Construct SLR parsing table for the following grammar

R-> R->R’1R/RR/R*/(R)/a/b.

24. a. Distinguish top down and bottom up parsing (JNTU Apr/May 05)b. Construct a recursive Decent parser for the following grammar.

E->E+T/TT->TF/fF->F*/a/b

25. Construct LALR parsetable for the following grammar (JNTU Apr/May 05)S ->Aa|bAc|Bc|bBaA ! dB ! d .

26 . a. What is an SLR grammar (JNTU Apr/May 04)b. Construct LALR(1) parse table for the following grammar for

S ->Aa|bAc|dc|bdaA ! d

27. a. What is LR(1)parsing? (JNTU Apr 03)b. Construct canonical LR parse table for the following Grammar’

S->Aa/bAc/bBaA->dB->d.

28. Define shift reduce parser with an example grammar

29. Differentiate between LR, LALR and SLR parser

30. What is predictive parser & shift reduce parser

31. What is an ambiguous grammar

32. Define how to handle ambiguous grammar

33. Explain the meaning of Handle by giving suitable example

34. Design SLR(1) parser for the following grammar.S->aAb/bBA->Aa/εB->Bb/ ε

35. Design LALR(1) parser for the following grammarS->aAd/bBd/aBc/bAcA->e

Page 36: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

B->e

36. “if the grammar is ambiguous then there exist exactly one handle for each right sentential form” comment.

37. Design SLR(1) parser for the grammar give below S->aAbA->Aa/ ε

38. If LALR(1)parser is designed for the grammar. S->aAbA->Aa/ εHow many states the LALR(1) parser will have

39. Design CLR(1) parser for the grammar give below S->aAbA->Aa/ ε

40. What is the advantage of left recursive grammar over right recursive grammar in LR parsing. Explain with suitable example

41. A grammar containing left recursion cannot be LL(1),therefore a grammar containing right recursion cannot be LR(1).comment

42. Give an example of a grammar that is LL(1),but not SLR(1)

43. Construct an LALR(1) parsing table for the following grammarS->Aa/aAc/Bc/bBaA->db->d

44. Construct an SLR(a) parsing table for the following grammarS->xAy/xBy/xAzA->as/qB->q

45. Let L= L1^L2 when L1,L2 are languages as defined below (GATE 09)L1 = { am bm c an bn /m,n >=0}L2 = { ai bj ck / i,j,k >= 0} then L is

a not recursive b regular c context free but not regular d. recursively enumerable but not context free

46. Which of the following statements are TRUE? (GATE 09)

I. There exist parsing algorithm for some programming language whose complexities are less than (n3)

II. A programming language which allows recursion can be implemented with static storage allocation.

III. No- L attributed definition can be evaluated in the framework of bottom up parsing IV. Coding improving transformation can be performed at both source language and intermediate code

levela I and II b I and IV c III and IV d I,II, IV

47. N LALR (1) parser for the grammar Gcan have shift –reduce ( S- R) conflicts if and only if a. the SLR (1) parser G has S-R conflicts.

b. the LR (1) parser G has S-R conflicts. c. the SLR (0) parser G has S-R conflicts. d. the LALR (1) parser G has reduce-reduce conflicts.

Page 37: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(GATE 08)

48. Consider the grammar: (GATE 05)S->(S)/ €Let the number of states in SLR(1),LR(1) and LALR(1) parsers for the grammar be n1,n2 and n3 respectively . the following relationship hold goods:(a) n1<n2<n3 (b) n1=n3<n2 (c) n1=n2=n3 (d) n1>n3>n2

49. Consider the grammar shown below (GATE 03)S->CCC->Cc/dThis grammar is(a) LL(1) (b) SLR(1)but not LL(1)(c) LALR(1) but not SLR(1) (d) LR(1) but not LALR(1)

50. Which of the following statements is false? (GATE 01)a. An ambiguous grammar has same leftmost and rightmost derivationb. An LL(1)parser is a top down parserc. LALR is more powerful than SLRd. An ambiguous grammar can never be LR(k) for any k

51. Which of the following derivations does a top-down parser use while parsing an input string? The input is assumed to be scanned in left to right order. (GATE 00)

a. Leftmost derivationb. Leftmost derivation traced out in reversec. Rightmost derivationd. Rightmost derivation traced out in reverse

52. Which of the following is the most powerful parsing method? (GATE 99)(a) LL(1) (b) Canonical LR (c) SLR (d) LALR

53. Which of the following statements is true? (GATE 98)a. SLR parser is more powerful than LALRb. LALR parser is more powerful than Canonical LR parserc. Canonical LR parser is more powerful than LALR parserd. The parsers SLR ,Canonical LR ,And LALR have the same power

54. Which of the following features cannot be captured by context –free grammars? (GATE 94)a. Syntax of if-then –else statementsb. Syntax of recursive procedures c. Whether a variable has been declared before its used. Variable names of arbitrary length

55. Consider the SLR(1) and LALR(1) parsing tables for the context free grammar. Which of the following statements is/are true?

(GATE 92)

a. The go to part of both tables may be different.b. The shift entries are identical in both the tables.c. The reduce entries in the tables may be different.d. The error entries in the tables may be different.

Page 38: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

UNIT – IV 1. (a) Construct triples of the expressions: a[i] := b and a := b[i](b) Generate the three-address code for the following `C' program fragment:

(i) for( i = 1; i <= 20; i++) if( a < b) x = y + z; (JNTU May 11)

2. Generate the three-address code for the following `C' program fragment:switch(a + b). [16]fcase 2: x = y; break;case 5: switch(x)fcase 0: a = b + 1; break;case 1: a = b + 3; break;default: a = 2; break;gbreak;case 9: x = y - 1; break;

(j) default: a = 2; break; (JNTU May 11)

3. (a) Write a short note on abstract syntax tree.(b) Compare and contrast the quadruples, triples & indirect triples. (JNTU June 10)

4. Translate the executable statements of the following `C' program into a three-address code by assuming each element of an array `a' takes 4 bytes. [16]void main()fint i = 1, a[10];while(i++ < = 10)a[i] = 0; (JNTU June 10)

g

5. a) What is a Syntax Directed Translation Scheme? Explain with an example. b) Design an abstract syntax tree for the expression: a = (a[i+1] = 2) + a[j]. (JNTU June 10))

6. a) What is syntax directed translation? Explain with example. (JNTU May 09) b) Describe about S-attributed and L-attributed grammars.7.(a) What is abstract syntax tree? Explain with example.(b) Describe semantic analysis. (JNTU May 09)8 Explain about Intermediate code in detail. (JNTU May 09)9. Explain syntax directed translation of control flow statements. (JNTU May 09)

10. (a ) Explain quadruples, Triples,and Indirect triples. (b) Construct Quadruple, Ttriples,and Indirect Triples of the following expression

( a + b) * ( c + d )- ( a + b + c) (JNTU Nov 08) 11 Consider the following grammar::

D. TL

Page 39: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

T INT /FLOATL L,ID/ID

(a) Write the Syntax Directed Definition to add the type of each identifier to its entry in the Symbol table during semantic analysis. (b) Draw an annotated parse tree for the declaration: float,id1,id2,id3; (JNTU Nov 08) 12. Let synthesized attribute ,Val give the value of the binary number generated by S in the following

Grammar . For example, on input 101.101,S.Val = 5.625.S L * L / LL LB / BB0 / 1. (JNTU Nov 08)

Write synthesized attribute values corresponding to each of the productions to determine the S.Val13. (a) what is a three address code ? Give an Example. (b )Give detail analysis on generic function and polymorphic function? (JNTU Nov 08)

14. a. Explain in detail how an L-attributed grammar can be converted into a translator scheme. b. Give the translate scheme to convert an expression grammar into three address code.

(JNTU Apr/May 07, 06, Aug/Sep 07)

15. Write type expression for the following types (JNTU Apr/May 07, 06, Nov/Dec 05, Apr 03)a. An array of pointers to real, where the array index ranges from 1 to 100. b. A two dimensional array of integers ( i.e. an array of arrays) whose rows are indexed from 0 to 9

and w hose columns are indexed from-10 to 10.c. Functions whose domains are functions from integers to pointers to integers and whose ranges are

records consisting of an integer and a character.

16 a. What are L-attributed grammars. (JNTU Apr/May 07, Nov 05)b. Explain the steps involved in converting an L-attributed grammar into translator scheme.

17. a. What are S-attributed and L-attributed grammars. (JNTU Nov/Dec 05, Apr/May 05)b. Write a S-attributed grammar to connect the following grammar with prefix rotators

L!EE!E+TE!E-TE!TT!T*FT!T/FT!FF!P" FF!PP!(E)P!id.

18 Write a syntax directed translators scheme to translate the following grammars for declaration statementD->TLT->intT->redL->LdidL->id

19 a. The following grammar generator all possible binary numbers (JNTU Apr 03)S->L.L/L

L->LB/BB->0/1

Page 40: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

Write a syntax directed translator scheme to translate the given binary number into its equivalent decimal number

b. Distinguish s-attributed and L-attributed grammars.

20. a. Define S –attributed and L-attributed grammars. . (JNTU Nov 03)b. Write a syntax directed definition to convert the given binary number with its decimal equivalent

21 a. What is a syntax tree? (JNTU Dec/Jan 03)b. How to construct syntax tree for expressions?c. Construct a syntax tree for the expression

a-4+c

22 a. Explain the reasons for separating lexical analysis phase from syntax analysis.b. Eliminate ambiguities from the following grammar

S ! iEtSeS|iEtS|aE ! b|c|d (JNTU Apr/May 07, 06, Nov/Dec 05, Aug/Sep 07, Apr 03)

23. Explain Why every s-attributed definition is L-attributed?

24 Write a grammar for the following control structure:Do N times SWrite syntax directed translation to go along with this grammar to translate it into three address

code.

24. Differentiate between Quadraples, triples & indirect triples

25. Explain clearly with examples ,the conditions under which an assignment statement can be subjected to hoisting out of a loop

26. Explain Flow –of-control constructs

27. Explain briefly the terms Quadraples, triples

28 Explain briefly the terms triples, indirect triples

29. What does syntax directed translation mean ?

30. Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input ‘2’*3+4’,this translation scheme prints(A)2*3+4(B)2*+3 4(C)2 3 4 +*(D) 2 3 4 +*

31. Consider the syntax directed translation schema (SETS)shown below:E->E+E{print”+”}

E->E*E{print”.”}E->id{print id.name}E->(E)

32. An LR-parser executes the actions associated with the productions immediately after a reduction by the corresponding production .Draw the parse tree and write the translation for the sentence.(a+b)*(c+d), using SDTS given above

33. Convert the following expression to postfix expression

Page 41: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(a+b)*(c+f)

34 Convert the following expression to prefix expression(a+b)*(c+f)

35. Define syntax direct definition? Write the form of SDD.

36. What is synthesized attribute? Explain its functions.

37. Define annotated Parse tree. Explain with an example.

38. What is inherited attributes? Explain its functions.

39. What is dependency graph. Explain with an example.

40. Write the procedure for construction of syntax tres for expressions.

41. What is the transalation scheme. Explain in detail.

42. Explain the procedure for left recurtion from a translation scheme.

43. Explain about control flow statements.

44. What is a three addressed code? Explain the following.a. Quadrapleb. Tripplesc. Indirect triples

45. Explain about the anyalysis of syntax direct definition .

46. Consider the following Translation Schema (GATE 06)S->ERR->*E{print(‘*’);}R/€E->F->E{print(‘+’);}/FF->(S)/id{print(id.value);}Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input ‘2’*3+4’,this translation scheme prints(A)2*3+4(B)2*+3 4(C)2 3 4 +*(D) 2 3 4 +*

47. Consider the grammar with the following translate on rules and E as the start symbol (GATE 04)

E->E1#T {E.value=E1.value * T.value} / T {E.value=T.value}T->T1&F {T.value=T1.value * F.value} / F {T.value=F.value}F->num {F.value=num.value}Compute E.value for the root of the parse tree for the expression :2#3&5#6&4(a)200 (b)180 (c)160 (d)40

48. Consider the syntax directed translation schema (SETS)shown below: (GATE 96)E->E+E{print”+”}E->E*E{print”.”}E->id{print id.name}

Page 42: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

E->(E)An LR-parser executes the actions associated with the productions immediately after a reduction by the corresponding production .Draw the parse tree and write the translation for the sentence.(a+b)*(c+d), using SDTS given above

49. Convert the following expression to postfix expression(a+b)*(c+f)

UNIT – V

1. (a) Distinguish static and dynamic Type checking?(k) (b) Discuss in detail about semantic analysis phase? b(JNTU May 11)

2. (a) Write a short note on type equivalence.(b) Write a short note on type checking. (JNTU June 10)

3. (a) Explain Type Conversion. Give the Type conversion rules for converting thetype from integer to real.(b) Explain the algorithm for testing the structural Equivalence. (JNTU June 10)

4. Write and Explain about algorithm for construction of equivalence trees? (JNTU June 10)

5. What is Type Expression? Write type Expressions for the following types a) An array of pointers to real, where the array index ranges from 1 to 100 b) Function whose domains are functions from integers to pointers to integers and whose ranges are records consisting of an integer and a character (JNTU June 10)

6.a) What is Context Sensitive Grammar? Write its features. (JNTU May 09)b) Explain Type Checking with example.7 Describe Chomsky hierarchy of languages and recognizers. (JNTU May 09)8.(a) Write notes on type conversion.(b) Describe about type expressions. (JNTU May 09)9. Write notes on overloading of functions and operations. (JNTU May 09)

10. a. What is a type checker ? How does it work? (JNTU Nov 08, Apr/May 07, Aug/Sep 06, .Nov 03)b. Write a short notes on static and dynamic type checking.

11. a. Type checking of expressions.b. Translation scheme for checking the type of statements (JNTU Nov 08)

12. . a. Discuss about the overloading of functions and operators with an examples. b. What are the advantages and disadvantages of Name equivalence. Explain with examples

(JNTU Nov 08)

Page 43: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

13. . a Explain Chomsky Hierarchy of languages b. Give a detail analysis on generic function and polymorphic function (JNTU Nov 08)

14. Write type expression for the following typesa. An array of pointers to real, where the array index ranges from 1 to 100. 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.c. Functions whose domains are functions from integers to pointers to integers and whose ranges are

records consisting of an integer and a character. (JNTU Apr/May 07, 06, Nov/Dec 05, Apr 03)

15. a. Which of the following recursive type expressions are equivalent? Justify your answer?e1 = integer ! e1 e2 = integer !(integer ! e2) e3 = integer !( integer !e1).

b. Suppose that the type of each identifier is a sub range of integers for expressions with the operators +, -,* , div and mod as in Pascal. Write type? Checking rules that assign to each sub expression, the sub range its value must lie in. (JNTU Apr/May 07, 05, 04 Aug/Sep 07)

.

16. a What is type expression? Write type expression for the following types. i. 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. (JNTU Apr/May 07, Apr 03)

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

b. What is type system. Discuss static and dynamic checking of types.

17. a. What are the advantages and disadvantages of Structural equivalence. Explain with example. b. What are the advantages and disadvantages of Name equivalence. Explain with examples.

(JNTU Apr/May 06, 05, 04, Nov/Dec 05, Aug/Sep 06, Nov 05)

18. Write type expression for the following types (JNTU Apr/May 06)a. An array of pointers to real, where the array index ranges from 1 to 100. 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. c. Functions whose domains are functions from integers to pointers to integers and whose ranges are

records consisting of an integer and a character.

19. a. How do you check the expressions in polymorphic functions? Explain through an example. b. Consider the following declarations

type link = " cell;var next : link;last : link;p : " cell;q,r : " cell;Which among the following expressions are Structurally equivalent? Which are name equivalent? Justify your answer.

i. linkii. pointer(cell)iii. pointer(link)iv. pointer(record((info X integer) X (next X pointer(cell))) (JNTU Apr/May 06)

20 a. List out some typical semantic errors . Explain how they can be rectified? b. What is static checking ? Give some examples of static checks.

Page 44: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(JNTU Apr/May 06, Aug/Sep 07, Nov/Dec 05)

21 a. Write a note on the specification of a Simple type checker. (JNTU Nov/Dec 05, Aug/Sep 07)b. Explain the equivalence of type expressions with appropriate examples.

22. a. Discuss about the overloading of functions and operators with an examples. b. Write a notes on polymorphic functions.

(JNTU Aug/Sep 06, 07, Nov/Dec 04, 05, 03, Apr/May 05, 04)

23. a. What is type-graph? How cycles are represented in type- graph? Give example. b. Give a detail analysis on generic function and polymorphic function.

(JNTU Aug/Sep 06, Apr/May 05, 04)

24. a. What is type expression? Write type expression for the following types. (JNTU Aug/Sep 06)i. 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.

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

b. What is type system. Discuss static and dynamic checking of types.

25. Write short notes on (JNTU Apr 03)a. Type conversion with example.b. Type coercion with example

26. a. What is meant by structural equivalence of type expressions. Write a function which will test the structural equivalence of two type expressions.

b. Discuss briefly about type conversions. What is Coersion? The grammar for expression is given below. Write the semantic rules for coercionfrom integer to realE->numE->num.numE->idE->E1 op E2

27. a. Explain about the specification of a simple type checker. (JNTU Dec/Jan 03)b. Explain the static storage allocation strategy for storage allocation

28. Write a grammar for expressions, and Write to count the number of reductions made by the parser, to go along with your grammar

29 What is the advantage of using lower bound for each dimension of an array to be 0?

30. Explain the Chomsky Hierarchy of various languages.31. a. What is type cheking.?

b. Draw the position type cheker. And explain.

32. a. Define type systems.b. Explain about static checking of types.

33. What is type expressions.

34. Explain the dynamic checking of types.

35. Explain the specification of simple type cheker.

36. Discuss with the following

Page 45: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

a. Type checking of expression.b. Type checking of statements.c. Type checking of functions.

37. Discuss the with the equivalaince of type expressions.

38. Explain the cycles in representation of types.

39. Definie type converstion. Explain in detail with a suitable example

40. a. What is coercion? b. Explain the implicit type convertions.

41. a. Define the overloading of function.b. Explain the set of possible types for sub expressions.

42. a. Define the overloading of operaters.b. Explain the Narrowing the set of possible types.

43. What are the type variables. Explain in detail.

UNIT – VI

1. (a) Explain how scope information is represented in the symbol table for blockstructured language?

(l) (b) Write and explain about activation record? (JNTU May 11)

2. (a) Describe the method to obtain faster access to nonlocals.(b) Describe the facilities provided by languages for dynamic allocation of storageof data. (JNTU June 10)

3. a) Explain concept of explicit allocation of fixed-sized blocks b) Explain concept of explicit allocation of variable-sized blocks. (JNTU June 10)

4. Explain about: a) a variable local to a procedure b) a global variable

Page 46: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

c) a formal parameter d) a dynamically allocated global variable e) a compiler generated temporary variable. (JNTU June 10)

5 .What are the language facilities for dynamic storage allocation? (JNTU May 09)6.. How to handle local names and parameters? (JNTU May 09)3 Describe about Storage Organization in detail. (JNTU May 09)7. Describe dynamic storage allocation stratagies. (JNTU May 09)8. a.Write a notes on the static storage allocation strategy with examples and discuss its limitations.

b. Discuss about the static allocation strategy of run-time environment with examples. (JNTU Apr/May 06, 05, Nov/Dec 05, Aug/Sep 06, Nov 05,Nov 08)

9. Explain about storage allocation strategies in Block structured Languages. (JNTU Nov 08)10. Write and explain the following a. Activation Tree b. Activation record11 Explain hash table organization of symbol tables for block structure languages (JNTU Nov 08)12. What are self-organizing lists. How this can be used to organize a symbol table. Explain with an

example. (JNTU Apr/May 07, Apr 03)

13 a. Which data structure will be used to implement a symbol table in an efficient way? Give reasons. (JNTU Apr/May 07, 05, Aug/Sep 07, Nov/Dec 04, Apr 03)

b. Discuss and analyze about all the allocation strategies in run-time storage environment.

14. a. Explain how the symbol table space can be reused. Explain through an example.b. Discuss various symbol table organization techniques. (JNTU Apr/May 07, Nov 03)

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

(JNTU Apr/May 06, 05, Nov/Dec 05, Apr 03)

15. a. What are the contents of a symbol table? Explain in detail. b. What is the data structure used to implement a symbol table in an efficient way? Give reasons?

(JNTU Apr/May 06, 05, 4, Aug/Sep 06)

16 a. Which data structure will be used to implement a symbol table in an efficient way? Give reasons. b. Discuss and analyze about all the allocation strategies in run-time storage environment.

(JNTU Apr/May 06, Nov/Dec 04, Aug/Sep 07)

17. a. Write detailed notes on the symbol table mechanism using tree data structure. b. Explain with an example about the symbol table mechanism using hash table data structures.

(JNTU Apr/May 06, Nov 05)

18 a. What is an activation record? Explain how it is related with run time storage organization. b. Write a short notes on heap strategy and run-time storage allocation. (JNTU Aug/Sep 06)

19. a. Explain how the symbol table space can be reused. Explain through an example. (JNTU Nov 05)b. Discuss various symbol table organization techniques.

20 a. Write a notes on the static storage allocation strategy with examples and discuss its limitations b. Discuss about the stack allocation strategy of run-time environment with examples

Page 47: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

(JNTU Apr/May 05, Nov 03)

21. a What are the advantages and disadvantages of Static storage allocation strategy?(JNTU Apr/May 04)

b. What are the advantages and disadvantages of Heap storage allocation strategy? 22. a. What is dangling reference in storage allocation ?Explain with an example. (JNTU Apr/May 04)

b. Explain hash table organization of symbol tables for block structure languages.

23. Explain in detail the various storage allocation strategies. (JNU Apr/May 04)

24. a. Explain how the scope information is represented in the symbol table for the block structured language.

b. Suppose P(x.y) is a C procedure and it is called by P(A+B,C).Show the intermediate code generated for the call and return make arbitrary assumptions about the locations of A,B and C in the activation record for the calling procedure

(JNTU Apr 03)

25. Write detailed notes on : (JNTU Dec/Jan 03)a. Symbol table organizationb. peephole optimization

26. Heap allocation is required for languages. (GATE 97)a. that support recursionb. that support dynamic data structuresc. that use dynamic scope rulesd. none of the above

26 Explain how do u reuse t=symbol table space?

27. Describe about the data structures for a symbol table in detail

28. Explain briefly about implementation of block structured languages

29. What is an error & what are the sources if error

30 What do u mean by a syntactic error, illustrate

31 What do u mean by a Semantic error, illustrate

32 What are the different errors seen by each phase what are they

33 Describe briefly about Dynamic errors

34 Explain briefly about Syntactic phase errors

35 Explain briefly about error recovery in operator – precedence parsing

36 Explain briefly about Lexical phase errors

37 Explain how do u handle shift –reduce errors

38. Explain briefly about error recovery in LR parsing

39 Explain briefly about error recovery in LL parsing

Page 48: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

40 Explain briefly about Ad-hoc error recovery in LR parsing

41 Define format of activation records in detail

42 Explain briefly about Run time storage allocation

43. Explain about Block Structure storage allocation

44. Explain about Non Block structure storage allocation

45. Explain briefly about storage allocation for arrays

46. Explain briefly about storage allocation for strings

47. Explain briefly about storage allocation for records

48. Explain briefly about implementation of a Simple Stack Allocation Scheme

49. What are self organizing lists? How can this be used to organize a syntax table?Explain with an examples.

50. Discuss and overlarge about all the allocation strategies in Runtime storage Environment.51. Explain the static data area implementing static allocation.

52 What is an Activation Record? Explain its fields in details.

53 Write a short notes on the static storage allocation strategy with an example and discuss its ciritations.

54. Discuss about the stack allocation strategy of Run time envi. With an example.

55. Write a short notes on heap strategy and run time storage allocation.

56. What are the advantages and disadvantages of heep storage allocation strategies.

57. Explain how an activation record is related with run time storage organizations.

58. What is dangling reference in storage allocation? Explain with an example.

59. Differentiate b/w static allocation with stack allocation?

60. Explain the memory allocation in a Block structure language ?

61. Explain in brief about the register allocation for temporary and use informed variables.

62. Explain the Basic Issues for allocating memory to a data items in details.

63. What is return sequence? Write the advantages of stack allocation.

64. Explain the storage allocation for Arrays, strings, and Records.

65. Explain the languages features for dynamic stages allocation.

Page 49: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

66. Differentiate b/w static & dynamic storage allocation

67. Explain in details of implicit deal location.

68. Suppose P(x, y) is a c programs, and it is called by P(A+B+C). Show the intermediate code generated for call and return make assumptions about the locations of A, B and C in the activation record of the calling.

UNIT – VII

1. (a) Define the following:i. Basic Blockii. Local Optimizationiii. Global Optimization.(b) Explain about Algebraic Transformations?

(m)(c) \Copy propagation Leads to Dead code" - Justify the statement. (JNTU May 11)

2. Explain Linear bounded automaton with an Example?

3. Explain the following:(a) Redundant loads and stores(b) Un reachable code(c) Flow-of-control optimization(d) Algebraic simpli_cation.4. Consider following code:beginread n;for i=1 to n doa[i]=true;count=0;for i=2 to n**5 doif a[i] thenbegincount=count+1;for j=2* i to n by i doa[j]=falseendprint countendGenerate three address code and draw ow graph. What optimizations can beperformed? Generate an optimized code. (JNTU June 10)

5. (a) Explain how loop invariant computation can be eliminated?(b) Explain how \Redundant sub-expression eliminates" can be done in a givenprogram? (JNTU June 10)

6. Describe about principal sources of optimization. (JNTU May 09)7 Explain about optimization of basic blocks . (JNTU May 09)8. Describe about peephole optimization. (JNTU May 09)

Page 50: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

9. What is a flow graph? Explain data flow analysis of flow graphs. (JNTU May 09)

10. a What is a flow graph. Explain how a given program can be converted into a flow graph b Explain the loop optimization (JNTU Nov 08)11. Explain about Data-Flow analysis of structured flow graphs. (JNTU Nov 08)12. Explain the machine independent Optimization in detail. (JNTU Nov 08)13. Write and explain about Peephole optimization. (JNTU Nov 08)14. Explain with an example the abstract machine code form of Intermediate code.

(JNTU Apr/May 07, 06, Aug/Sep 06, 07, Apr/May 05, 04)

15. Give a detailed account on loop optimization techniques. (JNTU Apr/May 07)

16. Explain any two machine dependent code optimization techniques. (JNTU Apr/May 06, Aug/Sep 06, 07, Nov 03)

17. What is a DAG. Explain its application. (JNTU Apr/May 06, Aug/Sep 06)

18. Explain with an example how abstract machine code can be generated for a given if-then-else statement. (JNTU Apr/May 06, 05, Nov/Dec 05, Aug/Sep 06, Nov 03)

19. Write a short notes on peephole optimization. 20.. What are loop invariant components. Explain how they effect the efficiency of a program.

(JNTU Nov/Dec 05)

21. Compare various forms of three address code. (JNTU Nov/Dec 05)

22. What are the various machine dependent code optimization techniques. (JNTU Nov/Dec 05)

23. Convert the following arithmetic expression into syntax tree and three address code b* 3 (a+b) (JNTU Nov/Dec 05, Apr

03)

24. Give a translator grammar for converting Boolean expression into three address code.(JNTU Nov/Dec 05, Apr/May 05, Apr 03)

25. Apply the translation scheme on the following expression a< b or c< d and e< f. (JNTU Nov 05)

26. What are loop invariant components. Explain how they effect the efficiency of a program. (JNTU Aug/Sep 06, Nov

05)

27. Compare various forms of three address code. (JNTU Aug/Sep 06)

28. Write semantic routines to convert a ‘C’ while statement into three address code. (JNTU Nov/Dec 04, Apr/May 04)

29. Write short notes on peephole optimization techniques. (JNTU Apr/May 04)

30. What are the various machine dependent code optimization techniques. (JNTU Nov 05)

31. Convert the following arithmetic expression into syntax tree and three address code b* 3 (a+b) (JNTU

Nov 05)

Page 51: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

32. Give a translator grammar for converting Boolean expression into three address code. (JNTU

Nov 05)

33. Apply the translation scheme on the following expression a< b or c< d and e< f. (JNTU Nov 05)

34. What are the applications of DAG . Explain how the following expression in an can be converted in a DAG (JNTU Aug/Sep 07, Apr 03)a+b*(a+b)+c+d.

35. Explain how loop invariant components can be eliminated. (JNTU Aug/Sep 07)

36. Translate the expression –(a+b)*(c+d)+(a+b+c) into quadruple, triple and indirect triple (JNTU Apr/May 05, 04)

37. Explian in detail the optimization technique” Strength Reduction”. (JNTU Apr/May 05)

38. What are the Various machine dependent code optimization techniques (JNTU Apr/May 05)

39. Convert the following arithmetic expression into Syntax tree and three address code b*-(a+b)(JNTU Apr/May 05)

40. Write briefly about various loop optimization techniques (JNTU Apr/May 04, Apr 03)41. Convert the following Boolean expression into 3 address code

A<b and c<d or e>f . : (JNTU Apr/May 04, Apr 03)42. The following grammar generator all possible binary numbers (JNTU Apr 03)

S->L.L/LL->LB/BB->0/1Write a syntax directed translator scheme to translate the given binary number into its equivalent decimal number

43. Distinguish s-attributed and L-attributed grammars. (JNTU Apr 03)

44. Explain the quadruples ,triples and indirect triples of a three address statement of intermediate code.

(JNTU Dec/Jan 03)

45. Explain any four issues in the design process of a code generator.

46 Explain various machine dependent code optimization techniques machine dependent code optimization techniques

47 Briefly explain about loop optimization techniques

48 Briefly explain about scope of an optimization49. Briefly explain about loop &local optimization50. Explain what is Address Descriptor

51. Explain what is Register Descriptor

52. Explain briefly about global optimization

53. What is flow graph explain it by definition

54. Discuss the properties of reducible flow graph

Page 52: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

55. Explain briefly about some other loop optimizations

56. Explain the steps required for elimination of common sub expressions

57. Explain about copy propagation

58. What is induction variable ,define it

59. Explain with an algorithm steps required for detection and elimination of induction variable

60. Explain about reducible flow graphs

61. Discuss global optimization techniques. (JNTU Nov 05)

62. What are the various object code forms. (JNTU Nov/Dec 05)

63. Why Next-use information is required for generating Object code?

64. What are the application of du-and ud.

65. Discuss global optimization techniques

UNIT – VIII

1. Generate code for following instructions and their associated cost, assume 3 registersare available and all variables are static.(a) X = a[i] + 1(b) a[ i ] = b[ c[ i ] ](c) a[i][j] = b[i][k] * c[k][j]

(n) (d) a[i] = b[i] + c[j]. (JNTU May 11)

2. (a) Give the applications of DAG.(b) Generate code for the following C statements:i. x=++f(a)ii. _p++=_q++.3. a) Consider the following code sequence.

i. MOV B, R0 ADD C, R0 MOV R0, A ii. MOV B, A ADD C, A

Calculate the cost of above instructions interms of access time and memory usage. b) What are assembler directives and explain? (JNTU June 10)4. What are the object code forms? Explain the issues in code generation. (JNTU May 09)5. Explain about code generation algorithm with example. (JNTU May 09)6. Explain about register allocation and assignment in target code generation.

(JNTU May 09)7. What is DAG? Explain how a basic block is represented using DAG. (JNTU May 09)

Page 53: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

8. Explain issues in the design of a code generator. (JNTU Nov 08)9. a Explain the concept of calculating cost of instructions (JNTU Nov 08) b. Consider below addressing codes along with associated costs.

Mode Address Cost Absolute 1

Register 0Indexed 1Indirect register 0Indirect indexed 1

Compare costs of following set if Statementsi. mov b, R0

Add c,R0Mov R0,R1

ii. add R2,R!Mov R!,a

iii. Mov b,aAdd c,a

10. Write and Explain Heuristic Ordering algorithm for DAG with one example. (JNTU Nov 08)11. Write and explain about object code form. (JNTU Nov 08)

12. Explain the generic issues in the design of code generator. (JNTU Nov/Dec 05, Apr/May 05)

13 Write about the various object code forms. (JNTU Nov/Dec 05, Apr/May 05)

14 Efficient code generation requires the knowledge of internal architecture of the target machine. Justify your answer with an example. (JNTU Aug/Sep 06)

15 What are the various addressing mode are available? (JNTU Aug/Sep 06)

16. Give some examples of machine instructions which reduces memory access time.

17 a. Discuss the various forms of object code. (JNTU Aug/Sep 07, Nov 03)b. Explain how the nature of the object code is highly dependent on the machine and operating

system

18 Write a macro which takes A,B,C and D as parameters and calculates A*B+C*D in any registera. Where would you store the temporary result? b. Would you reserve space for the temporary results with in the macro body or outside it(i.e. In the

main program Why? What are the advantages and disadvantages of these alternatives. (JNTU Aug/Sep 07)

19 a. Define Address Descriptor and Register Descriptor (JNTUApr/May05)b. Why Next –use information is required for generating object code?c. What are the various object code forms

20. a. Explain how Lexical substitution is performed for model statements by a macro preprocessorb. Differentiate Positional and Keyword parameter. (JNTU Apr/May 05)c. How the value of the positional and Keyword parameter is determined?Explain with an example

21. a. Augment the code generation algorithm to incorporate the following features.(JNTU Apr/May 05)

i. the parenthesis is an expression

Page 54: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

ii. Non commutative operators like ‘-‘ and’/’ etcb. show various steps in the code generation algorithm of the expression

(a+b)/(c+d)Assuming two machine registers to be available.

22 Briefly explain the functions performed during Synthesis and Analysis Phase of an assembler design

(JNTU Apr/May 05, 04)

23 Write a macro which takes A,B,C and D as parameters and calculates A*B+C*D in any register a. Where would u store the temporary result?b. Would you reserve space for the temporary results with in the macro body or outside it (i.e. in the

main program) why? What are the advantages and disadvantages of these alternatives. (JNTU Apr 03)

24. Write the features of Assembly Language programming. (JNTUApr/May07, 04)

25. Write the general format of an Assembly language statement. (JNTU Apr/May 07)

26. Explain the 3 kinds of statements of an assembly program. (JNTU Apr/May 07, 04)

27. Explain how lexical substitution is performed for model statements by a macro preprocessor. (JNTU Apr/May 07)

28. Differentiate Positional and keyword parameter. (JNTU Apr/May 07)

29. How the value of the positional and keyword parameter is determined? Explain with an example. (JNTU Apr/May 07)

30. How are constants defined in an assembly program? Explain with an example.(JNTU Apr/May 07, Nov 05, 03)

31. What is meant by Assembler directives? Explain the functions of the following assembler directives.

i. STARTii. ORIGINiii. EQUiv. LTORG

32. List out the data structure to perform Macro Expansion. (JNTU Apr/May 06)

33. Write an algorithm for Macro processing (JNTU Apr/May 06)

34. Write the design specification for a parameter in macro statement (JNTU Apr/May 06, Nov/Dec 05, Aug/Sep 06)

35. What is meant by Expansion time Variable (EV). Write the syntax of two forms of Expansion time variable. (JNTU Apr/May 06)

36. How the value of EV can be manipulated through the preprocessor statement SET. Explain with an example (JNTU Apr/May 06)

37. Write the features of Assembly Language programming. (JNTU Apr/May 06)

38. Write the general format of an Assembly language statement. (JNTU Apr/May 06)

39. Explain the 3 kinds of statements of an assembly program. (JNTU Apr/May 06)

40. An assembly Language program contains the following statement.(JNTU Apr/May 06, Apr 03)X EQU Y + 25

Page 55: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

Indicate how the EQU statement can be processed by a single pas assembler If i. Y is a Back referenceii. Y is a Forward reference.

41. What are assembler directives.

42 Augment the code generation algorithm to incorporate the following features.(JNTU Apr/May 06)i. The parenthesis in an expressionii. Non commutative operators like ‘-‘ and ‘/’ etc

43. Show various steps in the code generation algorithm of the expression( a + b) / ( c + d)Assuming two machine registers to be available.

44. Explain the memory requirement for variant I and variant II of intermediate code of an assembler design. (JNTU Apr/May 06, Aug/Sep 06, 07)

45. How Declarative state and Assembler directives are processed by an assembler.

46. Differentiate single pass and two pass translation of an assembler. (JNTU Nov/Dec 05)

47. Explain Macro expansion and Lexical expansion. (JNTU Nov/Dec 05)

48. List out the data structure to perform Macro Expansion. (JNTU Nov/Dec 05, 04)

49. Write an algorithm for Macro processing. (JNTU Nov/Dec 05, 04)

50. Explain the generic issues in the design of code generator. (JNTU Nov/Dec 05, Apr/May 05)51. Write about the various object code forms. (JNTU Nov/Dec 05, Apr/May 05)

52. Explain the memory requirement for variant I and variant II of intermediate code of an assembler design. (JNTU Nov/Dec 05, Apr/May 05, Nov 03)

53. How Declarative state and Assembler directives are processed by an assembler.(JNTU Nov/Dec 05)

54. List out the data structure to perform Macro Expansion. (JNTU Nov/Dec 05)

55. Write an algorithm for Macro processing. (JNTU Nov/Dec 05)

57. Consider the following code sequence. (JNTU Aug/Sep 06, 07, Nov 05)i. MOV B, R0

ADD C, R0MOV R0 A

ii. MOV B,AADD C, ACalculate the cost of the above instructions in terms of access time and memory usage.

58. Explain the simple Strategy to generate assembly code from Quadruples. (JNTU Aug/Sep 06, 07, Nov 05)

59. Efficient code generation requires the knowledge of internal architecture of the target machine. Justify your answer with an example. (JNTU Aug/Sep 06)

60. What are the various addressing mode are available? (JNTU Aug/Sep 06)

61. Give some examples of machine instructions which reduces memory access time. (JNTU Aug/Sep 06)

62. Define the following

Page 56: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

i. Macro ii. Macro expansion iii. Lexical Expansion iv. Semantic Expansion (JNTU Aug/Sep 06, 07)

63. What is meant by Macro definition? Explain the data structures used in a Macro Processor.

64. Formulate an algorithm for the First pas of the assembler. Explain the Data structure used during the PASS I of an assembler. [16] (JNTU Aug/Sep 06, Apr/May 04)

65. a. Differentiate single pass and two pass translation of an assembler. (JNTU Nov 05)b. Explain Macro expansion and Lexical expansion.

66. Design the algorithm for the PASS II of an assembler. Explain the Data structure used in PASS II (JNTU Nov 05)

67. a. Discuss the various forms of object code. (JNTU Aug/Sep 07, Nov 03)b. Explain how the nature of the object code is highly dependent on the machine and operating

system

68. Write a macro which takes A,B,C and D as parameters and calculates A*B+C*D in any registera. Where would you store the temporary result? (JNTU Aug/Sep 07)b. Would you reserve space for the temporary results with in the macro body or outside it(i.e. In the

main program Why? What are the advantages and disadvantages of these alternatives.

69. a. Define Address Descriptor and Register Descriptor (JNTU Apr/May 05)b. Why Next –use information is required for generating object code?c. What are the various object code forms

70. a. Explain how Lexical substitution is performed for model statements by a macro preprocessorb. Differentiate Positional and Keyword parameter. (JNTU Apr/May 05)c. How the value of the positional and Keyword parameter is determined? Explain with an example

71. a. Augment the code generation algorithm to incorporate the following features. i. the parenthesis is an expression

ii. Non commutative operators like ‘-‘ and’/’ etc (JNTU Apr/May 05)

b. show various steps in the code generation algorithm of the expression(a+b)/(c+d)Assuming two machine registers to be available.

72. Briefly explain the functions performed during Synthesis and Analysis Phase of an assembler design

(JNTU Apr/May 05, 04)73. a. Write the general format of Macro Prototype statement and macro call give an example

b. What is meant by Conditional expansion and Expansion time Loops? c. Define Macro Expansion Counter (MEC).Mention its functions. (JNTU Apr/May 05)

74. Design the algorithm for the PASS II of an assembler .Explain the data Structure used in PASS II (JNTU Apr/May

04)

75. Write a macro which takes A,B,C and D as parameters and calculates A*B+C*D in any register a. Where would u store the temporary result?

Page 57: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

b. Would you reserve space for the temporary results with in the macro body or outside it (i.e. in the main program) why? What are the advantages and disadvantages of these alternatives.

(JNTU Apr 03)

76. a. Explain the design process of an assemblies (JNTU Dec/Jan 03)b. What is nested macro? Explain it with a suitable example.

77. a. Describe , how addressing modes can be used for reducing the memory access time. b. Generate the code sequence using Code generation algorithm for the following expression.

W := (A-B) + (A –C) + (A- C) (JNTU Aug/Sep 08)

78. a. Explain the different issues in the design of a code generator.b. Generate code for the following C Statements.

i . f (a) + f (a)ii . x= f(a) / g ( b,c)

iii. x = f ( f ( a)) iv. x = + + f ( a) (JNTU Aug/Sep 08)

79.Consider the following PASCAL program segment: If I mode 2 = 0 thenWhile i>=0 doBegin i:=I div 2;If I mod 2<>0 do then i:=i-1;Else i:=i-2EndAn appropriate loop invariant for the while loop is -----what are x and y in the following macro definition ? (GATE 95)macro Add x,yLoad y

Mul x Store y

End macro(a)Variables (b)Identifiers(c)Actual parameters (d)Formal parameters

80. Given the following source program (GATE 95)START 100A DS 3MOVER X,BADD X,CMOVEM X,DD EQU A+1L2 PRINT DC DC ‘5’ORIGIN L2 + 1STOPB DC ‘19’END.

a. Show the contents of the symbol table at the end of the PASS I b. Explain the significance of EQU and ORIGIN statements in the program. c. Show the intermediate code generated for the given program.

81. Given the following source program (GATE 95)START 100A DS 3MOVER X,BADD X,CMOVEM X,DD EQU A+1L2 PRINT D

Page 58: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

C DC ‘5’ORIGIN L2 + 1STOPB DC ‘19’END.

a. Show the contents of the symbol table at the end of the PASS I b. Explain the significance of EQU and ORIGIN statements in the program. c. Show the intermediate code generated for the given program.

82. Explain the generic issues in the design of code generator. 83. Write code generation algorithm .Explain it by taking suitable examples

84. Explain the design process of a macro processor

85. Briefly explain about DAG representation of basic blocks

86 Explain briefly about DAG construction

87 What do you mean by frequency reduction?

1.1.13 TUTORIAL SHEET

WEEK-1:

1.Define Finite automata. Explain its types indetail.2. What is NFA? Explain with an example.3. What is DFA? Explain with an example.4. Convert the following NFA to equivalent DFA

5. Explain the properties of regular expression with an example.

WEEK-2:

Page 59: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1.What is a translator? Explain about different translatrs indetail.2. Define compiler. Explain various phases of the compiler with a neat sketch.3. Explain the bootstrapping process with a suitable diagram.4. Write a general format of the LEX program and give an example. 5. . Describe lexical analysis and lex tools.

WEEK-3:

1. What is CFG? Give the examples.2. (a) Draw the parse tree for an expression: a_ - ( b + c )

(b) Give the Context Free Grammar(CFG) that generates the set f0 to 1 3. (a) Give the CFG generating the set of palindromes over an alphabet (b) Consider the following recursive grammar : S Sa/Sb/ a/b

Obtain an equivalent grammar with NO left recursion.4. Explain about left linear and right linear grammars with examples.5.Define ambiguity. Give the examples.

WEEK-4:

1. a.Define LL(1) grammar. b.Construct LL(1) parse table for the following grammar.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

2. Compute the FIRST and FOLLOW sets of each of the non –terminal for the following grammar.

P AQRbe / mn/ DeiA ab / ^Q q1q2/^R r1r2/^D dE e.

3. Construct a Predictive parser table for the following grammar. E->E+T/T T->T*F/FF->(E) /xy/xz

4. Find the reduced grammar that is equivalent to the CFG given below:S->aC/SBA->bSCaB->aSB/bBCC->aBC/ad

5. Construct the given grammar and test whether grammar is LL(1) or not .S->1AB/ εA->1AC/0CB->0SC->1

WEEK-5:

Page 60: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

1. Construct SLR parsing table for following grammar:E ! E + T=TT ! T _ F=FF ! (E)=id.

2. What is handle pruning? Explain3. Construct LALR parse table for the following grammer (JNTU Apr/May 07, 06, 04, Aug/Sep 07)

S ! L = RS ! RL ! _RL ! id

R ! L4. Design SLR(1) parser for the following grammar.

S->aAb/bBA->Aa/εB->Bb/ ε

5. Design CLR(1) parser for the grammar give below S->aAbA->Aa/ ε

WEEK-6:

1. . (a) what is LR parser ? Compare and Contrast the different types of Lr parser. (b) Construct the CLR parse table for the following augmented grammar::

A1 AA ( A ) /a

2. Describe about YACC. 3. a. Construct the SLR parse table for the following grammar.

S->Aa/bAc/dc/bda A->db. Distinguish SLR ,LALR grammar

4.Compare among LR(0),LALR, CLR indetail.5. Define shift reduce parser with an example grammar

WEEK-7:

1. Write a short note on abstract syntax tree.2. Compare and contrast the quadruples, triples & indirect triples.3. Construct Quadruple, Ttriples,and Indirect Triples of the following expression

( a + b) * ( c + d )- ( a + b + c)4. what is a three address code ? Give an Example

5 a. What is a syntax tree? b. How to construct syntax tree for expressions? c. Construct a syntax tree for the expression

a-4+c

WEEK-8:

1. What is a Syntax Directed Translation Scheme? Explain with an example

Page 61: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

2. Describe about S-attributed and L-attributed grammars3. Explain in detail how an L-attributed grammar can be converted into a translator scheme4. Explain Flow –of-control constructs

5. (a) What is synthesized attribute? Explain its functions.

(b)What is inherited attributes? Explain its functions

WEEK-9:

1. What is Context Sensitive Grammar? Write its features2. Explain Chomsky Hierarchy of languages3. What is type cheking.?

. 4 a. What is a type checker ? How does it work? b. Write a short notes on static and dynamic type checking.5. a What is type expression? Write type expression for the following types.

i. 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.ii Functions whose domains are functions from integers to pointers to integers and whose ranges are records consisting of an integer and a character.

c. What is type system. Discuss static and dynamic checking of types.

WEEK-10:

1. a.Discuss about the overloading of functions and operators with an examples. b. Write a notes on polymorphic functions.

2. Write short notes on a. Type conversion with example.b. Type coercion with example

3. a.Define type systems.b. Explain about static checking of types.

4. Discuss with the followinga. Type checking of expression.b. Type checking of statements.c. Type checking of functions.

5. Discuss the with the equivalaince of type expressions.

WEEK-11: 1. . Explain about: a) a variable local to a procedure b) a global variable c) a formal parameter d) a dynamically allocated global variable e) a compiler generated temporary variable. 2. a. What is an activation record? Explain how it is related with run time storage organization.

b. Write a short notes on heap strategy and run-time storage allocation. 3. a.What are the contents of a symbol table? Explain in detail.

b. What is the data structure used to implement a symbol table in an efficient way? Give reasons?4. Explain about Block Structure storage allocation

Page 62: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

4. Explain about Non Block structure storage allocation

WEEK-12:

1. Explain in detail the various storage allocation strategies.

2. Explain how the scope information is represented in the symbol table for the block structured language.

3. Explain briefly about storage allocation for arrays,strings, records.4. Differentiate b/w static & dynamic storage allocation

5. Discuss about the stack allocation strategy of Run time envi. With an example.

WEEK-13:

1. Describe about the data structures for a symbol table in detail

2. Explain hash table organization of symbol tables for block structure languages.

3. Explain heap table organization of symbol tables for block structure languages.4.Explain stack table organization of symbol tables for block structure languages.5.Explain static table organization of symbol tables for block structure languages.

WEEK-14:

1. Describe about principal sources of optimization2. Explain about optimization of basic blocks3. Describe about peephole optimization4. Explain the machine independent Optimization in detail5. Compare various forms of three address code

WEEK-15:

1. Explain about Algebraic Transformations?2. What is a flow graph? Explain data flow analysis of flow graphs.

3. What are loop invariant components. Explain how they effect the efficiency of a program 4. Apply the translation scheme on the following expression a< b or c< d and e< f.

5. Briefly explain about loop &local optimization

WEEK-16:

1. Briefly explain about DAG representation of basic blocks

Page 63: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

2. What are the various addressing mode are available? 3. Explain about code generation algorithm with example4. Explain about register allocation and assignment in target code generation.5. . a Explain the concept of calculating cost of instructions

b. Consider below addressing codes along with associated costs.Mode Address Cost

Absolute 1Register 0Indexed 1Indirect register 0Indirect indexed 1

1.1.14 ASSIGNMENT QUESTIONS

UNIT-I:

1. Write a general format of the LEX program and give an example. 2. Define DFA and NFA. Give examples.3. Define FA and RE. Give examples.4. Construct minimum state DFAs for the following regular expressions.

i. (a+b)* a (a+b) [3]ii. (a+b)* a (a+b) (a+b) [3]iii. (a/b)* a (a/b)(a/b)(a/b). [3]

5Construct an NFA for the regular expression R=(a+b)* abb convert it in to an equivalent DFA6. Compare compiler and interpreter with the help of suitable example.

7. Define compiler. Explain various phases of the compiler with a neat sketch.8. Explain the bootstrapping process with a suitable diagram.

9. Write a general format of the LEX program and give an example. 10. Describe lexical analysis and lex tools.

UNIT-I1:

1. What is CFG? Explain with an example.2. Define the following with ex.

a. Parse tree b. LMD c. RMD3. What is LL(1) grammar? Explain the steps involved in it.4. Explain ambiguous grammar and LL(K) grammar5. Differentiate left linear grammar and right linear grammar6. Construct a Predictive parsing table for the following grammar where S/ is a start symbol and # is

the end marker.S/->S#

Page 64: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

S->qABCA->a/bbDB->a/ εC->b/ εD->c/ ε

7. Construct LL(1) parsing table for the following grammarS->aBDhB->cCC->bC/ εD->EFE->g/ εF->f/ ε

8. Compute the FIRST and FOLLOW sets for each non terminal of the grammar given below:S->ABa/bCaA->cBCD/ εB->CdA/adC->eC/ εD->bSf/a

9. Construct the LL(1) table for the following grammar.1. Expr->_Expr2. Expr->(Expr)3. Expr->Var Expr Tail4. ExprTail->_Expr5. ExprTail->^6. Var ->id Var Tail7. VarTail->(Expr)8. VarTail->^9. Goal->Expr$

10. Design LL(1) parse table for the following grammar.S->aAcd/BCeA->b/ εB->Cf/, C->fe

UNIT-III:

1. What is Parsing? Explain about bottom up parsing techniques.2. What is handle pruning? Explain3. Describe about YACC4. Explain ambiguous grammars5. Consider the following grammar :

E->E+T/T T->T*F/FF->(E) /a

Construct the SLR parse table .6. Construct LALR(1) parse table for the following grammar for

S ->Aa|bAc|Bc|bBaA ! dB ! d .

7. Compare among LR(0),LALR, CLR in detail.8. Consider the following augmented grammar: S-> E

Page 65: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

E E+T T a/(E)

(c) Construct the DFA whose states are the canonical collection of LR(0) items.Construct the SLR(1) parse table.

9. Construct SLR parsing table for the following grammarR-> R->R’1R/RR/R*/(R)/a/b.

10. Define shift reduce parser with an example grammar

UNIT-IV:

1. (a) Write a short note on abstract syntax tree.(b) Compare and contrast the quadruples, triples & indirect triples

2. Design an abstract syntax tree for the expression: a = (a[i+1] = 2) + a[j3. Construct Quadruple, Ttriples,and Indirect Triples of the following expression

( a + b) * ( c + d )- ( a + b + c)4. Consider the following grammar::

D. TLT INT /FLOATL L,ID/ID

(a) Write the Syntax Directed Definition to add the type of each identifier to its entry in the Symbol table during semantic analysis.

(b) Draw an annotated parse tree for the declaration: float,id1,id2,id3;5. What is a Syntax Directed Translation Scheme? Explain with an example6. Explain in detail how an L-attributed grammar can be converted into a translator scheme7. What are S-attributed and L-attributed grammars.8. What is synthesized attribute? Explain its functions.

9 Define annotated Parse tree. Explain with an example.

. 10 What is inherited attributes? Explain its functions.

UNIT-V:

1. Explain Chomsky Hierarchy of languages2. Distinguish static and dynamic Type checking?

3. Discuss in detail about semantic analysis phase?Explain Type Conversion. Give the Type conversion rules for converting thetype from integer to real.

4. Explain the algorithm for testing the structural Equivalence5. What is Context Sensitive Grammar?6. Write notes on overloading of functions and operations. 7. aWhat is type expression? Write type expression for the following types.

Page 66: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

i. 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. ii. Functions whose domains are functions from integers to pointers to integers and whose

ranges are records consisting of an integer and a character.

b. What is type system. Discuss static and dynamic checking of types.8. What is type expression? Write type expression for the following types

9. a.What is coercion? b. Explain the implicit type convertions.

10. Define the overloading of operaters.

UNIT-VI:

1. a.Explain how the symbol table space can be reused. Explain through an example.b. Discuss various symbol table organization techniques.

2. a.What is an activation record? Explain how it is related with run time storage organization. b. Write a short notes on heap strategy and run-time storage allocation.

3. Define format of activation records in detail4. .What are the language facilities for dynamic storage allocation? 5. How to handle local names and parameters? 6 Describe about Storage Organization in detail. 7. Describe dynamic storage allocation stratagies.8. a.Write a notes on the static storage allocation strategy with examples and discuss its limitations.

b. Discuss about the static allocation strategy of run-time environment with examples.

UNIT-VII:

1. . Describe about principal sources of optimization.2 Explain about optimization of basic blocks. 3. Describe about peephole optimization.4. What is a flow graph? Explain data flow analysis of flow graphs.

5. a What is a flow graph. Explain how a given program can be converted into a flow graph b Explain the loop optimization 6. Explain about Data-Flow analysis of structured flow graphs.7. Explain the machine independent Optimization in detail. 8. Write and explain about Peephole optimization. 9. Explain with an example the abstract machine code form of Intermediate code.10. Write briefly about various loop optimization techniques

UNIT-VIII:

1. What are the object code forms? Explain the issues in code generation. 2. Explain about code generation algorithm with example. 3. Explain about register allocation and assignment in target code generation4. Explain the generic issues in the design of code generator. 5 Write about the various object code forms.

Page 67: 1. SUBJECTWISE DETAILS 1.1 AUTOMATA AND …docshare01.docshare.tips/files/7663/76630311.pdf · 1.1.13 Question Bank i. JNTU ii. ... The course exposes students to the computability

6 Efficient code generation requires the knowledge of internal architecture of the target machine. Justify your answer with an example.

7. What are the various addressing mode are available? 8. Give some examples of machine instructions which reduces memory access time. 9. What is DAG? Explain how a basic block is represented using DAG


Recommended