Sunteți pe pagina 1din 10

1 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING COURSE PLAN Subject Semester / Branch Prerequisite: Students should have an introductory

knowledge of automata, formal language theory and computability. Objectives: 1. To have an understanding of finite state and pushdown automata. 2. To have a knowledge of regular languages and context free languages. 3. To know the relation between regular language, context free language and corresponding recognizers. 4. To study the Turing machine and classes of problems : Formal Languages and Automata Theoru : II / CSE-1

LESSON PLAN

II B.Tech II Semester
Automata Theory & Compiler Design
Faculty: G.sankararao
UNIT-I Syllabus::
Formal Language and Regular Expressions: Languages, operations on languages, regular expressions (re), languages associated with (re), operations on (re), Identity rules for (re), Finite Automata: DFA, NFA, Conversion of regular expression to NFA, NFA to DFA. Applications of Finite Automata to lexical analysis, lex tools..

Objectives:
To know about basic concepts of FLAT

Lecture plan:
S.No Topic 1 2 3 4 5 6 7 Overview of FLAT basics i.e symbol,string,prefix,suffix, set alphabet, etc..
Languages, operations on languages regular expressions (re) languages associated with (re), operations on (re), Identity rules for (re), Finite Automata: DFA, NFA, Conversion of regular expression to

No. of lectures 1 1 1 1 1 1 1

Lecture date

NFA

2 1 1

NFA to DFA Applications of Finite Automata to lexical analysis, lex tools

9 Important Questions:
1a) Design a DFA that accepts the language over _ = {0, 1} of all strings that contain neither thesub-string 00 nor the sub-string 11. b) Prove the following regular expression identities: i) + 1* (011)* (1* (011)* )* = (1 + 011)* ii) 1 + ( + 0)( + 0)* 1 = 0* 1 2a) Design a DFA that accepts the language over the alphabet, _ = {0, 1, 2} where the decimal equivalent of the language is not divisible by 3. (b) Give a finite state diagram that accepts all the floating-point numbers.

UNIT-II Syllabus: Context Free grammars and parsing:


Context free Grammars, Leftmost Derivations, Rightmost Derivations, Parse Trees, Ambiguity Grammars, Top-Down Parsing, Recursive Descent Parsers: LL(K) Parsers and LL(1) Parsers

Objectives:
To understand about various types of grammars and parsing techniques

Lecture Plan:
S.No Topic 1 2 3 4 5 6 7 8
Context free Grammars Leftmost Derivations Rightmost Derivations Parse Trees Ambiguity Grammars Top-Down Parsing Recursive Descent Parsers LL(K) Parsers and LL(1) Parsers

No. of lectures 1 1 1 1 1 1 1 1+1 9

Lecture date

Important Questions:
1. Test whether the following grammar is LL(1) or not. S -> AaAb |BbBa A->a 2. Construct the predictive parse table for the following grammar: S->A 2

3 A -> aB|Ad B -> bBC|f C -> g 3. Consider the Grammar: G = ({S, A}, {a, b}, {S-> aAa |bAb| |A, A-> SS}, S) Find the leftmost derivation, rightmost derivation, and parse tree for the string: baabbb. 4. Write a procedure to combine two NFA?s into a single NFA. The operations to be performed are those of concatenation, union and closure. \ 5. Write a Context Free Grammar(CFG) for the while statement in C language. 6. Construct predictive parsing table for the following grammar. E ->T E E -> +T E| T ->F T T -> FT| 7. What is ambiguous grammar? Eliminate ambiguities for the grammar: E ! E + E|E_E|(E)|id. [Apr/May 2008,Set2] 8. Consider the following grammar. S ->0A|1B|0| 1 A -> 0S|1B| 1 B ->0A|1 S Construct leftmost derivations and parse trees for the following sentences i. 0101 ii. 1100101[Apr/May 2008,Set3] B -> d 9. Exlain Recursive Descent parser with an example.

UNIT III Syllabus : Bottom up parsing:


Rightmost Parsers: Shift Reduce Parser, Handles, Handle pruning, Creating LR (0) Parser, SLR (1) Parser, LR (1) &LALR (1) Parsers, Parser Hierarchy, Ambiguous Grammars, Yacc Programming Specifications .

Objectives :
3

4 To know about shift reduce parsing To understand the LR and LALR parsing

Lecture Plan:
S.No Topic 1 2 3 4 5 6 7 8 9 10
Rightmost Parsers Shift Reduce Parser Handles, Handle pruning Creating LR (0) Parser, SLR (1) Parser LR (1) &LALR (1) Parsers, Parser Hierarchy Ambiguous Grammars Yacc Programming Specifications

No. of lectures 1 1 1 1 1+1 1+1 1 1 1 1 12

Lecture date

Important Questions: .
1 What is LR parser? Compare and contrast the different types of LR parsers. 2. Construct the CLR parse table for the following augmented grammar: A-> ! A A ->(A) |a 3. What is meant by a parser generator? Illustrate with examples using YACC. 4. How are ambiguities resolved in YACC? 5. Construct SLR parsing table for the following grammar S -> AS|b A->SA|a 9. Define LR(k) parser. Draw and explain model of LR parser. 10. Write LR parsing algorithm. 11. Show that the following grammar is LL(1) but not SLR(1). [Feb 2003] S -> AaAb | BbBa A -> e B -> e 12. What is Shift-Reduce and Reduce-Reduce conflict? How these can be resolved? With examples explain in which condition S-R and R-R conflict can occur in SLR, canonical LRand LALR parsers. (Make use of LR(0), LR(1) items) 14. Explain concept of back-patching with example. 4

UNIT-IV Syllabus : Syntax Directed Translation:


Definitions, construction of Syntax Trees, S-attributed and L-attributed grammars, Intermediate code generation,abstract syntax tree, translation of simple statements and control flow statements

Objectives:
To understand about Boolean expressions translations To understand about syntax directed transulations To understand about polish notation

Lecture Plan:
S.No Topic 1 2 3 4 5 6 7 8
Syntax Directed Translation construction of Syntax Trees S-attributed and L-attributed grammars Intermediate code generation abstract syntax tree translation of simple statements control flow statements

No. of lectures 1 1 1 1 1 1 1 1

Lecture date

3-adds code generation

8 Important Questions:
1. Compare Inherited attributes and Synthesized attributes with an example. 2. Construct triples of an expression: a * - (b + c). 3. 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 |L L ->LB|B B ->0 |1 Write synthesized attribute values corresponding to each of the productions to determine the S.Val. 5

6 4. Generate the three-address code for the following ?C? program fragment: [16] while(a > b) { if (c < d) x = y + z; else x = y - z; } 5. What are L-attributed definitions? Explain with an example. 6. Draw the syntax tree for the following Boolean expression: (P < Q AND R < S) OR (T < U AND R <Q).

UNIT-V Syllabus: Semantic Analysis:


Semantic Errors, Chomsky hierarchy of languages and recognizers, Type checking, type conversions, equivalence of type expressions, Polymorphic functions, overloading of functions and operators. .

Objectives:
To understand about typechecking To understand the concepts like polymorphics functions

Lecture Plan:
S.No Topic 1 2 3 4 5 6 7 8
Semantic Errors Chomsky hierarchy of languages and recognizers Type checking type conversions equivalence of type expressions Polymorphic functions overloading of functions and operators..

No. of lectures 1 1 1 1 1+1 1 1 1

Lecture date

Review

9 Important Questions:
1. List out various typical semantic errors .Explain the procedure to rectify them? 2. What is Static Checking? List out some examples of static checks? 3. Explain the following: (a) Type checking of Expressions (b) Translation scheme for checking the type of statements. 6

7 4. What is Type Expression? Write type Expressions for the following type i. A Two dimensional array integers (i.e. an array of arrays) whose rows are indexed from 0 to 9 and whose columns are indexed from -10 to 10. 5. What is Type System? Discuss static and dynamic Checking of types? 6. Distinguish static and dynamic Type checking ? 7. Discuss in detail about semantic analysis phase? 8. Compare three different storage allocation strategies.

UNIT-VI Syllabus: Storage Organization:


Storage language Issues, Storage Allocation, Storage Allocation Strategies, Scope, Access to Nonlocal Names, Parameter Passing, Dynamics Storage Allocation Techniques..

Objectives:
To understand about runtime environment To understand about scope access

Lecture Plan:
S.No Topic 1 2 3 4 5 6
Storage language Issues Storage Allocation Storage Allocation Strategies Scope, Access to Nonlocal Names, Parameter Passing Dynamics Storage Allocation Techniques..

No. of lectures 1 1 1+1 1 1 1+1

Lecture date

8 Important Questions:
1. Write a notes on the static storage allocation strategy with example and dis-cuss its limitations? 2. Discuss about the stack allocation strategy of runtime environment with an example? 3. Explain the concept of implicit deallocation of memory 4. Give an example of creating dangling references and explain how garbage is 7

8 created 5. Write a notes on the static storage allocation strategy with example and dis- cuss its limitations? 6. Write and explain about activation record?

UNIT-VII Syllabus: Data flow analysis : Code Optimization:


Issues in the design of code optimization, Principal sources of optimization, optimization of basic blocks, Loop optimization, peephole optimization, flow graphs, Data flow analysis of flow graphs.

Objectives:
To understand concepts like data flow equation and flow graphs To understand about induction variable elements

Lecture Plan:
S.No Topic 1 2 3 4 5 6 7 8
Issues in the design of code optimization Principal sources of optimization optimization of basic blocks Loop optimization peephole optimization flow graphs Data flow analysis of flow graphs.

No. of lectures 1 1+1 1 1 1 1 1+1 1

Lecture date

review

10

Important Questions
1. Explain about Data-Flow analysis of structured flow graphs 2. Explain the following (a) Copy Propagation (b) Dead-Code Elimination 4. Explain in detail the procedure that eliminating global common sub expression? 5. Write and explain live variable analysis algorithm 6. Explain the use of algebraic transformations with an example 7. Explain reducible and non-reducible flow graphs with an example. 8. Explain natural loops and inner loops of a flow graph with an example Explain about data flow analysis of structured programs.

UNIT VIII Syllabus: Object code generation : Issues in the design of code Generation, Machine Dependent Code
Generation, object code forms, generic code generation algorithm, Register allocation and assignment, DAG representation of basic Blocks, Generating code from DAGs

Objectives:
To understand the concepts like machine dependent code optimization to understand various algorithms

Lecture Plan:
S.No Topic 1 2 3 4 5 6 7
Issues in the design of code Generation Machine Dependent Code Generation, object code forms generic code generation algorithm Register allocation and assignment DAG representation of basic Blocks Generating code from DAGs

No. of lectures 2 1 1 1 1 1 1 7

Lecture date

Important Questions:
1. Explain about Generic code generation algorithm 2. What are legal evolution orders and names for the values at the nodes for the DAG for following? 9

10 d := b + c e := a + b b := b * c a := e - d. 3. Construct DAG for the following basic block: d: = b+c e: = a+b b: =b*c a: = e-d. 4. Write and explain about object code forms? 5. Explain the different issues in the design of a code generator 6. Generate code for the following C statements: i. x= f(a) + f(a) + f(a) ii. x= f(a) /g(b,c) iii. x= f(f(a)) iv. x= ++f(a) [Apr/May 2008,Set1] 7. Explain the concept of object code forms

10

S-ar putea să vă placă și