23
Department of Information Technology Automata and Compiler Design III B Tech – I Semester [Branch: IT] (2007-08) M.Srikanth Yadav Assistant Professor Guru Nanak Engineering College Ibrahimpatnam, R R District – 501 506 (A. P.)

Acd-cf 05 Batch

Embed Size (px)

Citation preview

Page 1: Acd-cf 05 Batch

Department of Information Technology

Automata and Compiler Design

III B Tech – I Semester [Branch: IT]

(2007-08)

M.Srikanth YadavAssistant Professor

Guru Nanak Engineering CollegeIbrahimpatnam, R R District – 501 506 (A. P.)

Page 2: Acd-cf 05 Batch

Results Target

Total Strength of the Class: 61

S. No Class / Division No. of Students

a. First Class with Distinction 25

b. First Class 25

c. Pass Class 11

Course Plan

S. No Plan Brief Description

a. Class Lectures 65 Lectures

b. Design Issues -

c. Presentations Grammars

d. Demonstration -

e. Models / Mini Projects -

f. Guest Lectures

Method of Evaluation

a. Internal Examination 4

b. Assignments 4

c. Descriptive Exam 2

d. Final Examination 1

Page: 2

Page 3: Acd-cf 05 Batch

Course Objective

Automata and compiler design is one of the core computer subject, which will

provide the information related to the compilers and their design. It will cover the type

of grammars and set of designing principles for designing a compiler. Parsing

techniques like Top-down and bottom-up approaches.

It explains all phases in the designing of a compiler and also explains each

and every phase with suitable example, which will give a better idea for the students.

And also explains different mechanisms for designing of each and every phase of

the compiler.

Guidelines to Students

To implement the parser and compiler concepts we should know all the related fields

of compiler and all phases of compiler like lexical analysis, syntax analysis.

Types of parsers and grammars and their implementation mechanisms are important

in designing of compiler

JNTU Syllabus

Page: 3

Page 4: Acd-cf 05 Batch

AUTOMATA AND COMPILER DESIGN SYLLABUS

UNIT-1Formal 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 Automata to lexical analysis, lex tools.

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

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

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

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

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

UNIT-7Code optimization: Principal sources of optimization, optimization of basic blocks, peephole optimization, flow graphs, Data flow analysis of flow graphs.

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

Subject: Automata and Complier design

Books / Material/ Course Schedule

Text Books (to be acquired by the Students)

Book 1 Introduction to Theory of computation.Sipser,2nd Edition, Thomson

Book 2 Compilers Principles, Techniques and Tools Aho, Ullman, Ravisethi, Pearson Education

Reference Books

Book 3 Modern Compiler Construction in C, Andrew W.Appel Cambridge University Press.

Book 4 Compiler Construction, LOUDEN, Thomson

Unit TopicDate No of

ClassesFrom To

I Formal Language and Regular Expressions : 8

II Context Free grammars and parsing : 9

III Bottom up parsing handle: 8

IV Semantics : 8

V Context Sensitive features: 8

VI Run time storage: 7

VII Code optimization : 8

VIII Code generation : 9

Classes for above curriculum topics 05

Tutorial classes 07

Descriptive tests 03

Unit tests 05

Total Classes 85

Topic wise Coverage

Page: 4

Page 5: Acd-cf 05 Batch

Unit – 1

H.No Date Topic [Book – 2]

1. Languages, Strings Alphabets

2. operations on Languages and strings

3. Regular expressions

4. Finite Automata – DFA, NFA.

5. Conversion of regular expression to NFA,

6. NFA to DFA.

7. Applications of Finite Automata to lexical analysis,

8. lex tools

Unit- 2

9. Context free grammars

10. derivation,

11. parse trees,

12. ambiguity in derivation trees

13. LL(K) grammars and

14. LL(1) parsing

15. Recursive parser

16. predictive parser

17. Non recursive predictive parser

Unit –3

18. Bottom up parsing

19. handle pruning

20. LR Grammar Parsing,

21. SLR Parsing

22. CLR Parsing

23. LALR parsing,

24. parsing ambiguous grammars,

25. YACC programming specification

Unit-4

26. Syntax directed translation, .

27. S-attributed and

28. L-attributed grammars,

29. Intermediate code

30. Types of Intermediate code

31. abstract syntax tree,

32. translation of simple statements and

33. Control flow statements

Unit-5

34. Context Sensitive features

35. Chomsky hierarchy of languages and

36. Recognizers.

Page: 5

Page 6: Acd-cf 05 Batch

37. Type checking,

38. type conversions,

39. equivalence of type expressions,

40. Overloading of functions and

41. Operations

Unit-6

42. Storage organization,

43. Storage types

44. storage allocation strategies

45. scope access to now local names,

46. parameters,

47. Language facilities for dynamics storage allocation

48. Types of

Unit-7

49. optimization,

50. Principal sources of optimization,

51. Optimization of basic blocks,

52. peephole optimization,

53. flow graphs,

54. Data flow graphs

55. Representation of DFD

56. Analysis of flow graphs

Unit – 8

57. Machine dependent code generation,

58. Modes of Generation

59. object code forms,

60. generic code generation algorithm,

61. Types Algorithms

62. Register allocation and assignment.

63. Using DAG representation of Block

64. Properties of DAG

65. Implementation of DAG

Page: 6

Page 7: Acd-cf 05 Batch

Actual Date of Unit Completion & Remarks

Unit – 1

Date : __ / __ / __

Remarks:________________________________________________________________________

________________________________________________________________________

Unit – 2

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 3

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 4

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 5

Page: 7

Page 8: Acd-cf 05 Batch

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 6

Date : __ / __ / __ :

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 7

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 8

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Assignments

Automata and Compiler Design Home Assignment

Page: 8

Page 9: Acd-cf 05 Batch

Week – 1

1a) List the basic functions of a language translator.b) Bring out the difference between compiler and interpreter.c) What is bootstrapping? Explain it with example.

2a) Giving neat diagram explain all the phases of the compilation with example.b) What is the difference between pass and a phase?

Week – 2

3a) Explain the need for look a head operator.b) Write a procedure for minimizing number of states of a DFA, & explain with one example.

4 Write Short Notes on 1) LEX 2) Regular expression 3) FSM5 Explain a protocol using selective repeat

Week – 3

6 What is lexical analysis? Give reasons for separating lexical analysis from syntax analysis.

7 a) What is left recursive grammar? How to eliminate it?b) Explain left factoring a grammar with example.

Week – 4

8 Rewrite the following grammar for if else statement eliminating ambiguity. smt if expr then stmt | if expr then stmt else stmt | others where stmt , expr are non terminals and others are terminals

9Exercises 4.1 & 4.2 from Book 1(Text book).

Week –510 Giving algorithm explain non recursive predictive parsing with example.

11Prove that the given grammar is not LL (1). S iEtSS’/ a , S’ eS / є , E b

12 Give the algorithm for finding FIRST and FOLLOW for given CFG.

13 What is recursive descent parser? Write recursive descent Parser for the

following grammar? E →TE' , E' → TE' /t , T → FT ' , T '→ *FT ' /t , F → (E)/id

Week – 6

14

a) Explain briefly, precedence functions. Construct the precedence graph using the following precedence table

+ * ( ) Id $f 2 3 0 4 4g 1 3 5 0 4

b) Explain the construction of LALR parser table for given grammar with example15 Explain in detail Transport Bridges and source routing bridges

Week – 716. Write short notes on Dependency graph & DAG.17. Illustrate the difference between Synthesized attributes & inherited attributes.

Week – 8

18a) What is type checker? Write translation schemes for type checking expressions.b) Give the specification for simple type checker.

19 Discuss type conversion & type coercion with example. Week – 9

20

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

21

Explain in brief the polymorphic functions. Write the translation scheme for checking polymorphic Functions.

Week – 1022 a) Explain about quadruples, triples and indirect triples of a three-address

statement of Intermediate code.b) Give a translator grammar for converting a Boolean expression into three

Page: 9

Page 10: Acd-cf 05 Batch

address code. Apply the translation scheme on the following expression acb or ccd and e<f.

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

24

a) Explain the heap allocation strategy for storage allocation.b) Explain the need for symbol table. List and discuss all the data structures used for Implementing symbol tables.

Week – 11

25.Discuss the issues in the design of Code Generator. Write code generation algorithm and explain it by taking suitable example

26 Explain all code optimization techniques. Illustrate the with suitable examples

Week – 12

27a) Explain the peephole optimization technique in detail.b) Explain the strength reduction loop optimization technique in detail.

28 Explain Global flow analysis methods.

Week – 13

29 a) What are the various machine dependent code optimization techniques?b) Explain the assembler directives in detail with examples.

Week – 14

30 What is two pass assembler? Write algorithms for pass 1 and pass 2 assembler . Discuss Briefly, different tables used by pass 1 and pass 2 assembler .

31Week – 15

32What is a micro processor? Write the algorithms for different phases of macro processor. Explain them briefly?

Tutorial [as many planned per unit]

Unit – 1

Page: 10

Page 11: Acd-cf 05 Batch

1.

2.

Unit – 2

1.

2.

Unit – 3

1.

2.

Unit – 4

1.

2.

Unit – 5

1.

2.

Unit – 6

1.

2.

Unit – 7

1.

2.

Unit – 8

1.

2.

Assignment Valuation SheetSubject: ACD Faculty Name: M.Srikanth Yadav

Date

RollNo Name 1 2 3 4 5

05B91A1201 A NEEHARIKA

Page: 11

Page 12: Acd-cf 05 Batch

05B91A1202 A MOHNISH VARDHAN GOWD

05B91A1203 A PRIYANKA

05B91A1204 AJAY KUMAR SHINDE

05B91A1205 ANUJ KUMAR TALUKA

05B91A1206 B HARISH CHANDER

05B91A1207 B SRAVAN KUMAR

05B91A1208 BEENAKAUR S

05B91A1209 BEERAM UDAYBHASKER REDDY

05B91A1212 CHALLA USHA

05B91A1213 D R RAMASWAPNA

05B91A1214 DIVYA C

05B91A1215 ESHWAR CHAND ASAWA

05B91A1216 G MANOGNYA

05B91A1217 G NIKHIL KUMAR

05B91A1218 J BINDU REDDY

05B91A1219 JYOTHI SHARMA

05B91A1220 K ANUSHA REDDY

05B91A1221 K ARUN KUMAR

05B91A1222 K SAURABH

05B91A1223 K SWETHA SREE

05B91A1224 KARTHIK KOTA

05B91A1225 KUNJA VINAY SAGAR DORA

05B91A1226 M.MONIKA JAIN

05B91A1227 MADHUKAR P

05B91A1228 MADHURI PRIYANKA PAYASAM

05B91A1229 MANI DEEPTHI VALLURU

05B91A1230 NALABOLU KARTHEEK REDDY

05B91A1231 NIMIT PERSHAD

05B91A1232 P ABHIRAM REDDY

05B91A1233 PATEL DHARMESH L

05B91A1235 PRASHANTH DIDDY

05B91A1236 PRITIKA PEDDI

05B91A1237 R ARVIND REDDY

05B91A1238 RADHIKA P

05B91A1239 ROHAN DHIREN DOSHI

Page: 12

Page 13: Acd-cf 05 Batch

05B91A1240 ROHAN SRIHARSHA PATNAIK B

05B91A1241 S HARINI

05B91A1242 S MEGHANA REDDY

05B91A1243 SAI MAHESHWAR RAO T N

05B91A1244 SAI SHANKAR R

05B91A1245 SAIKIRAN N

05B91A1246 SANBIR SINGH

05B91A1247 SRINATH REDDY K

05B91A1248 SURESH KUMAR K

05B91A1249 T RAJA RAM

05B91A1250 T RAM SWAROOP SINGH

05B91A1251 T SPANDANA

05B91A1252 TEJASIMHAREDDY KOLLI

05B91A1253 TRINA MARY JOSE

05B91A1254 V RAJA RAO

05B91A1255 V SAI SAILESH

05B91A1256 V V L S VIDYA

05B91A1257 VEEREN V SHRIKHANDE

05B91A1258 VEMPATI SANTOSH KUMAR

05B91A1259 VIKEN KUMAR M JAIN

05B91A1260 ZETENDRA LINGAMGUNTA

03B91A1203 A P SAI KIRAN

06B95A1201 KRISHNA SUMANTH GURRAM

06B95A1203 S SANTOSH KUMAR

06B95A1205 P. SRIDEVI

Attendance as per Internal

Date -

Roll No Name 1 2 3 4 5

05B91A1201 A NEEHARIKA

05B91A1202 A MOHNISH VARDHAN GOWD

05B91A1203 A PRIYANKA

Page: 13

Page 14: Acd-cf 05 Batch

05B91A1204 AJAY KUMAR SHINDE

05B91A1205 ANUJ KUMAR TALUKA

05B91A1206 B HARISH CHANDER

05B91A1207 B SRAVAN KUMAR

05B91A1208 BEENAKAUR S

05B91A1209 BEERAM UDAYBHASKER REDDY

05B91A1212 CHALLA USHA

05B91A1213 D R RAMASWAPNA

05B91A1214 DIVYA C

05B91A1215 ESHWAR CHAND ASAWA

05B91A1216 G MANOGNYA

05B91A1217 G NIKHIL KUMAR

05B91A1218 J BINDU REDDY

05B91A1219 JYOTHI SHARMA

05B91A1220 K ANUSHA REDDY

05B91A1221 K ARUN KUMAR

05B91A1222 K SAURABH

05B91A1223 K SWETHA SREE

05B91A1224 KARTHIK KOTA

05B91A1225 KUNJA VINAY SAGAR DORA

05B91A1226 M.MONIKA JAIN

05B91A1227 MADHUKAR P

05B91A1228 MADHURI PRIYANKA PAYASAM

05B91A1229 MANI DEEPTHI VALLURU

05B91A1230 NALABOLU KARTHEEK REDDY

05B91A1231 NIMIT PERSHAD

05B91A1232 P ABHIRAM REDDY

05B91A1233 PATEL DHARMESH L

05B91A1235 PRASHANTH DIDDY

05B91A1236 PRITIKA PEDDI

05B91A1237 R ARVIND REDDY

05B91A1238 RADHIKA P

05B91A1239 ROHAN DHIREN DOSHI

05B91A1240 ROHAN SRIHARSHA PATNAIK B

05B91A1241 S HARINI

Page: 14

Page 15: Acd-cf 05 Batch

05B91A1242 S MEGHANA REDDY

05B91A1243 SAI MAHESHWAR RAO T N

05B91A1244 SAI SHANKAR R

05B91A1245 SAIKIRAN N

05B91A1246 SANBIR SINGH

05B91A1247 SRINATH REDDY K

05B91A1248 SURESH KUMAR K

05B91A1249 T RAJA RAM

05B91A1250 T RAM SWAROOP SINGH

05B91A1251 T SPANDANA

05B91A1252 TEJASIMHAREDDY KOLLI

05B91A1253 TRINA MARY JOSE

05B91A1254 V RAJA RAO

05B91A1255 V SAI SAILESH

05B91A1256 V V L S VIDYA

05B91A1257 VEEREN V SHRIKHANDE

05B91A1258 VEMPATI SANTOSH KUMAR

05B91A1259 VIKEN KUMAR M JAIN

05B91A1260 ZETENDRA LINGAMGUNTA

03B91A1203 A P SAI KIRAN

06B95A1201 KRISHNA SUMANTH GURRAM

06B95A1203 S SANTOSH KUMAR

06B95A1205 P. SRIDEVI

Marks for Internal Theory Examination

Date -

Roll No Name 1 2 3 4 5

05B91A1201 A NEEHARIKA

05B91A1202 A MOHNISH VARDHAN GOWD

05B91A1203 A PRIYANKA

05B91A1204 AJAY KUMAR SHINDE

Page: 15

Page 16: Acd-cf 05 Batch

05B91A1205 ANUJ KUMAR TALUKA

05B91A1206 B HARISH CHANDER

05B91A1207 B SRAVAN KUMAR

05B91A1208 BEENAKAUR S

05B91A1209 BEERAM UDAYBHASKER REDDY

05B91A1212 CHALLA USHA

05B91A1213 D R RAMASWAPNA

05B91A1214 DIVYA C

05B91A1215 ESHWAR CHAND ASAWA

05B91A1216 G MANOGNYA

05B91A1217 G NIKHIL KUMAR

05B91A1218 J BINDU REDDY

05B91A1219 JYOTHI SHARMA

05B91A1220 K ANUSHA REDDY

05B91A1221 K ARUN KUMAR

05B91A1222 K SAURABH

05B91A1223 K SWETHA SREE

05B91A1224 KARTHIK KOTA

05B91A1225 KUNJA VINAY SAGAR DORA

05B91A1226 M.MONIKA JAIN

05B91A1227 MADHUKAR P

05B91A1228 MADHURI PRIYANKA PAYASAM

05B91A1229 MANI DEEPTHI VALLURU

05B91A1230 NALABOLU KARTHEEK REDDY

05B91A1231 NIMIT PERSHAD

05B91A1232 P ABHIRAM REDDY

05B91A1233 PATEL DHARMESH L

05B91A1235 PRASHANTH DIDDY

05B91A1236 PRITIKA PEDDI

05B91A1237 R ARVIND REDDY

05B91A1238 RADHIKA P

05B91A1239 ROHAN DHIREN DOSHI

05B91A1240 ROHAN SRIHARSHA PATNAIK B

05B91A1241 S HARINI

05B91A1242 S MEGHANA REDDY

Page: 16

Page 17: Acd-cf 05 Batch

05B91A1243 SAI MAHESHWAR RAO T N

05B91A1244 SAI SHANKAR R

05B91A1245 SAIKIRAN N

05B91A1246 SANBIR SINGH

05B91A1247 SRINATH REDDY K

05B91A1248 SURESH KUMAR K

05B91A1249 T RAJA RAM

05B91A1250 T RAM SWAROOP SINGH

05B91A1251 T SPANDANA

05B91A1252 TEJASIMHAREDDY KOLLI

05B91A1253 TRINA MARY JOSE

05B91A1254 V RAJA RAO

05B91A1255 V SAI SAILESH

05B91A1256 V V L S VIDYA

05B91A1257 VEEREN V SHRIKHANDE

05B91A1258 VEMPATI SANTOSH KUMAR

05B91A1259 VIKEN KUMAR M JAIN

05B91A1260 ZETENDRA LINGAMGUNTA

03B91A1203 A P SAI KIRAN

06B95A1201 KRISHNA SUMANTH GURRAM

06B95A1203 S SANTOSH KUMAR

06B95A1205 P. SRIDEVI

Page: 17

Page 18: Acd-cf 05 Batch

Marks for Descriptive Examination

Date -

Roll No Name 1 2 3 4 5

1 2 3 1 2 3 1 2 3 1 2 3 1 2 3

05B91A1201 A NEEHARIKA

05B91A1202 A MOHNISH VARDHAN GOWD

05B91A1203 A PRIYANKA

05B91A1204 AJAY KUMAR SHINDE

05B91A1205 ANUJ KUMAR TALUKA

05B91A1206 B HARISH CHANDER

05B91A1207 B SRAVAN KUMAR

05B91A1208 BEENAKAUR S

05B91A1209 BEERAM UDAYBHASKER REDDY

05B91A1212 CHALLA USHA

05B91A1213 D R RAMASWAPNA

05B91A1214 DIVYA C

05B91A1215 ESHWAR CHAND ASAWA

05B91A1216 G MANOGNYA

05B91A1217 G NIKHIL KUMAR

05B91A1218 J BINDU REDDY

05B91A1219 JYOTHI SHARMA

05B91A1220 K ANUSHA REDDY

05B91A1221 K ARUN KUMAR

05B91A1222 K SAURABH

05B91A1223 K SWETHA SREE

05B91A1224 KARTHIK KOTA

05B91A1225 KUNJA VINAY SAGAR DORA

05B91A1226 M.MONIKA JAIN

05B91A1227 MADHUKAR P

05B91A1228 MADHURI PRIYANKA PAYASAM

05B91A1229 MANI DEEPTHI VALLURU

05B91A1230 NALABOLU KARTHEEK REDDY

05B91A1231 NIMIT PERSHAD

05B91A1232 P ABHIRAM REDDY

05B91A1233 PATEL DHARMESH L

05B91A1235 PRASHANTH DIDDY

Page: 18

Page 19: Acd-cf 05 Batch

05B91A1236 PRITIKA PEDDI

05B91A1237 R ARVIND REDDY

05B91A1238 RADHIKA P

05B91A1239 ROHAN DHIREN DOSHI

05B91A1240 ROHAN SRIHARSHA PATNAIK B

05B91A1241 S HARINI

05B91A1242 S MEGHANA REDDY

05B91A1243 SAI MAHESHWAR RAO T N

05B91A1244 SAI SHANKAR R

05B91A1245 SAIKIRAN N

05B91A1246 SANBIR SINGH

05B91A1247 SRINATH REDDY K

05B91A1248 SURESH KUMAR K

05B91A1249 T RAJA RAM

05B91A1250 T RAM SWAROOP SINGH

05B91A1251 T SPANDANA

05B91A1252 TEJASIMHAREDDY KOLLI

05B91A1253 TRINA MARY JOSE

05B91A1254 V RAJA RAO

05B91A1255 V SAI SAILESH

05B91A1256 V V L S VIDYA

05B91A1257 VEEREN V SHRIKHANDE

05B91A1258 VEMPATI SANTOSH KUMAR

05B91A1259 VIKEN KUMAR M JAIN

05B91A1260 ZETENDRA LINGAMGUNTA

03B91A1203 A P SAI KIRAN

06B95A1201 KRISHNA SUMANTH GURRAM

06B95A1203 S SANTOSH KUMAR

06B95A1205 P. SRIDEVI

Lesson Plan [as many sheets as number of lectures planned]

Page: 19

Page 20: Acd-cf 05 Batch

Date : __ / __ / ____

Time / Hour :

On completion of this lecture the student shall be able to …

Teaching Aids …

Teaching Points …

Annexure to Lesson Plan

Page: 20