GUJARAT TECHNOLOGICAL UNIVERSITY

Size: px
Start display at page:

Download "GUJARAT TECHNOLOGICAL UNIVERSITY"

Transcription

1

2 Type of course: Core GUJARAT TECHNOLOGICAL UNIVERSITY SUBJECT NAME: Compiler Design SUBJECT CODE: B.E. 7 th SEMESTER Prerequisite: Data Structures and Algorithms, Theory of Computation, Rationale: Compiler Design is a fundamental/core subject of Computer Engineering. It teaches how Compiler of a Programming Language works. It also focuses on various designs of Compiler and structuring and optimizing various phases of a Compiler. It is also necessary to learn types of Grammar, Finite state machines, lex, yacc and related concepts of languages. Teaching and Examination Scheme: Teaching Scheme Credits Examination Marks Total L T P C Theory Marks Practical Marks Marks ESE PA (M) ESE (V) PA (E) PA ALA ESE OEP (I) Content: Sr. No. Content Total Hrs % Weightage 1 Overview of the Translation Process, A Simple Compiler, Difference between interpreter, assembler and compiler. Overview and use of linker and loader, types of Compiler, Analysis of the Source Program, The Phases of a Compiler, Cousins of the Compiler, The Grouping of Phases, Lexical Analysis, Hard Coding and Automatic Generation Lexical Analyzers, Front-end and Back-end of compiler, pass structure 2 Lexical Analyzer Introduction to Lexical Analyzer, Input Buffering, Specification of Tokens, Recognition of Tokens, A Language for Specifying Lexical Analyzers, Finite Automata From a Regular Expression, Design of a Lexical Analyzer Generator, Optimization of DFA 3 Parsing Theory Top Down and Bottom up Parsing Algorithms, Top-Down Parsing, Bottom-Up Parsing, Operator-Precedence Parsing, LR Parsers, Using Ambiguous Grammars, Parser Generators, Automatic Generation of Parsers. Syntax-Directed Definitions, Construction of Syntax Trees, Bottom-Up Evaluation of S-Attributed Definitions, L-Attributed Definitions, syntax directed definitions and translation schemes

3 4 Error Recovery Error Detection & Recovery, Ad-Hoc and Systematic Methods 5 Intermediate Code Generation Different Intermediate Forms, Syntax Directed Translation Mechanisms And Attributed Mechanisms And Attributed Definition. 6 Run Time Memory Management Source Language Issues, Storage Organization, Storage-Allocation Strategies, and Access to Non local Names, Parameter Passing, Symbol Tables, and Language Facilities for Dynamic Storage Allocation, Dynamic Storage Allocation Techniques. 7 Code Optimization Global Data Flow Analysis, A Few Selected Optimizations like Command Sub Expression Removal, Loop Invariant Code Motion, Strength Reduction etc. 8 Code Generation Issues in the Design of a Code Generator, The Target Machine, Run-Time Storage Management, Basic Blocks and Flow Graphs, Next-Use Information, A Simple Code Generator, Register Allocation and Assignment, The DAG Representation of Basic Blocks, Peephole Optimization, Generating Code from DAGs, Dynamic Programming Code-Generation Algorithm, Code- Generator Generators Suggested Specification table with Marks (Theory): Distribution of Theory Marks R Level U Level A Level N Level E Level C Level Legends: R: Remembrance; U: Understanding; A: Application, N: Analyze and E: Evaluate C: Create and above Levels (Revised Bloom s Taxonomy) Note: This specification table shall be treated as a general guideline for students and teachers. The actual distribution of marks in the question paper may vary slightly from above table. Reference Books: 1. Compilers: Principles, Techniques and Tools By Aho, Lam, Sethi, and Ullman, Second Edition, Pearson, Compilers: Principles, Techniques and Tools By Aho, Sethi, and Ullman, Addison-Wesley, Compiler Design in C By Allen I. Holub, Prentice-Hall/Pearson. 4. Advanced Compiler Design and Implementation By Muchnick, Morgan and Kaufmann, 1998.

4 Course Outcome: After learning the course the students should be able to: 1. Understand the basic concepts and application of Compiler Design 2. Apply their basic knowledge Data Structure to design Symbol Table, Lexical Analyser, Intermediate Code Generation, Parser (Top Down and Bottom Up Design) and will able to understand strength of Grammar and Programming Language. 3. Understand various Code optimization Techniques and Error Recovery mechanisms. 4. Understand and Implement a Parser. List of Experiments: 1. Design a lexical analyzer for given language and the lexical analyzer should ignore redundant spaces, tabs and new lines. It should also ignore comments. Although the syntax specification states that identifiers can be arbitrarily long, you may restrict the length to some reasonable value. Simulate the same in C language 2. Write a C program to identify whether a given line is a comment or not 3. Write a C program to test whether a given identifier is valid or not. 4. Write a C program to simulate lexical analyzer for validating operators 5. To Study about Lexical Analyzer Generator(LEX) and Flex(Fast Lexical Analyzer) 6. Implement following programs using Lex. a. Create a Lexer to take input from text file and count no of characters, no. of lines & no. of words. b. Write a Lex program to count number of vowels and consonants in a given input string. 7. Implement following programs using Lex. a. Write a Lex program to print out all numbers from the given file. b. Write a Lex program to printout all HTML tags in file. c. Write a Lex program which adds line numbers to the given file and display the same onto the standard output. 8. Write a Lex program to count the number of comment lines in a given C program. Also eliminate them and copy that program into separate file. 9. Write a C program for implementing the functionalities of predictive parser for the mini language. 10. Write a C program for constructing of LL (1) parsing. 11. Write a C program for constructing recursive descent parsing 12. Write a C program to implement LALR parsing. 13. Write a C program to implement operator precedence parsing. 14. To Study about Yet Another Compiler-Compiler(YACC). 15. Create Yacc and Lex specification files to recognizes arithmetic expressions involving +, -, * and /. 16. Create Yacc and Lex specification files are used to generate a calculator which accepts,integer and float type arguments.

5 Design based Problems (DP)/Open Ended Problem: Students can do a mini project in C to implement various phases of a Compiler considering a simple set of Instructions and other assumptions. They can also practice on LEX and YACC for various applications involving different Grammars etc. Major Equipment: PC, Unix Server/Client. List of Open Source Software/learning website: 1. nptel.ac.in ACTIVE LEARNING ASSIGNMENTS: Preparation of power-point slides, which include videos, animations, pictures, graphics for better understanding theory and practical work The faculty will allocate chapters/ parts of chapters to groups of students so that the entire syllabus to be covered. The power-point slides should be put up on the web-site of the College/ Institute, along with the names of the students of the group, the name of the faculty, Department and College on the first slide. The best three works should submit to GTU.

6 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII (NEW) - EXAMINATION SUMMER 2017 Subject Code: Date: 29/04/2017 Subject Name: Complier Design Time: PM to PM Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) Explain Semantic analysis and Syntax analysis phases of compiler with suitable example. Also explain the errors generated by these two phases. (b) Construct the NFA using thompson s notation for following regular expression and then convert it to DFA. (a / b)* ab# Q.2 (a) Check following grammar is LL (1) or not? S -> ab B -> bc C -> cs (b) What is left factoring and left recursion? Explain it with suitable example. (b) Construct CLR parsing table for following grammar. S -> asa A -> bs c Q.3 (a) Show that following grammar is not a SLR (1) grammar. S -> AaBa BbBa A -> B -> (b) Develop a syntax directed definition for following grammar. E -> TE E -> +TE T -> ( E ) T -> id Q.3 (a) Write a grammar to declare variables with data type int or float or char. Also develop a syntax directed definition for that. Draw the dependency graph for same. (b) Define operator precedence grammar. Construct precedence matrix and precedence graph for arithmetic grammar as shown below: E -> E + T T T -> T * F F F -> (E) id Q.4 (a) Explain Activation record and Activation tree in brief. (b) Explain Quadruple, triple, and indirect triple with suitable example. Q.4 (a) Write a note on peephole optimization. (b) Write a short note on symbol table management. Q.5 (a) Define a following: Basic block, Constant folding, Natural loop, Handle 1

7 (b) Construct DAG for a + a * (b- c) + (b c) * d. also generate three address code for same. Q.5 (a) Discuss the issues in the design of code generation. (b) Define dominators. Construct dominator tree for following graph. ************* 2

8 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII (OLD) - EXAMINATION SUMMER 2017 Subject Code: 1701 Date: 09/05/2017 Subject Name: Compiler Design Time: 02:30 PM to 05:00 PM Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) Explain various phases of compiler with example. (b) Explain input buffering methods. Q.2 (a) Explain symbol table with two data structures suitable for it. (b) Construct a DFA without constructing NFA for the following regular expression. (a b) * a (b) Explain subset construction method with an example. Q.3 (a) Explain SLR parsing method with an example. (b) How do you check whether the grammar is LL (1) or not? Justify your answer with appropriate example. Q.3 (a) Explain operator precedence parsing method. (b) Check the following grammar is LR(1) or not. S AaAb S BbBa A B Q.4 (a) Discuss differences between inherited attributes and synthesized attributes. (b) Write a short note on various representations of three address code. Q.4 (a) Explain syntax directed translation scheme with example. (b) Define: DAG. Explain DAG representation of basic block with example. Q.5 (a) Discuss various code optimization methods. (b) Explain code generator design issues. Q.5 (a) Explain static storage allocation technique. (b) Explain activation record organization in brief. ************* 1

9 Seat No.: No. Enrolment GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII(OLD) EXAMINATION WINTER 2016 Subject Code: 1701 Date: 29/11/2016 Subject Name: Compiler Design Time: 10:30 AM to 01:00 PM Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) Describe all phases of a compiler. (b) (i) What is a symbol table? Discuss the most suitable data structure for it by stating merits / demerits. (ii) Explain linker & loader. Q.2 (a) (i) Consider the grammar S -> SS+ SS* a Show that the string aa+a* can be generated by the grammar. Construct the parse tree for the grammar. Is the grammar ambiguous? (ii) Write unambiguous production rules for if then else construct. (b) Construct DFA without constructing NFA for following regular expression: a*b*a(a b)b*a# Minimize the same. (b) Construct NFA for following regular expression using Thompson s notation and then convert it into DFA. a(b c)*a*c# Q.3 (a) Apply shift reduce parser for parsing following string using unambiguous grammar. id - id * id - id (b) (i) Compare top-down and bottom-up parser. (ii) Explain right-most-derivation-in-reverse with the help of an example. Q.3 (a) Explain SLR parser. How is its parse table constructed? (b) Construct a precedence graph, precedence table for operator precedence parser to be used for parsing a string consisting of id, -, *, $. Parse following string. $ id - id * id * id $ Q.4 (a) Write production and semantic rules for producing and analyzing statements like : int * ip, i, j, *ip1; float * fp, f; (b) Explain synthesized attributes with the help of an example. Q.4 (a) Draw transition diagrams corresponding to production rules for arithmetic expressions consisting of operators + and ^ for predictive parser. Explain how parsing takes place for the same using transition diagrams. (b) (i) Explain various parameter passing methods. (ii) Explain left factoring with the help of an example. 1

10 Q.5 (a) Draw syntax tree and DAG for following statement. Write three address codes from both. a = (a + b * c) ^ (b * c) + b * c ^ a ; (b) Explain activation record. How is task divided between calling & called program for stack updating? Q.5 (a) For a statement given below, write output of all phases (except that of optimization phase) of a complier. a = a + b * c ; (b) Explain peephole optimization. ************* 2

11 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII EXAMINATION SUMMER 2016 Subject Code:1701 Date:16/05/2016 Subject Name:Compiler Design Time:02:30 PM to 05:00 PM Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) Explain different phases of compiler. (b) What is regular expression, give all the algebraic properties of regular expression. Q.2 (a) Draw the DFA for the regular expression (a b)*abb using set construction method only. (b) Unsigned numbers are strings such as 5280, 39.37, 6.336E4 or 1.894E-4, give the regular definitions for the above mentioned strings. (b) Draw the state transition diagram for the unsigned numbers. Q.3 (a) Convert the (a b c)*d*(a* b)ac + # regular expression to DFA directly and draw its DFA. (b) Write short note on context free grammar (CFG) explain it using suitable example. Q.3 (a) Explain all error recovery strategies using suitable examples. (b) Where do we use operator precedence parsing technique? Give the general precedence table for operating precedence parsing, considering all the generalized rules. Q.4 (a) What is left recursion? Eliminate the left recursion from the following grammar. E E + T T T T * F F F ( E ) id (b) Translate the expression (a*b)+(c*d)+(a*b*c) into 1. Quadruples 2. Triples 3. Indirect triples. Q.4 (a) Explain SLR parser in detail with the help of a suitable example. (b) Design the FIRST SET and FOLLOW SET for the following grammar. E E + T T T T * F F F ( E ) id Q.5 (a) Explain how type checking & error reporting is performed in compiler. Draw syntax tree and DAG for the statement a = (a * b + c) ^ (b + c) * b + c. Write three address codes from both. (b) Explain peephole optimization. 1

12 Q.5 (a) Differentiate SLR, Canonical LR and LALR. Also justify the statement A class of grammar that can be parsed using LR methods is a proper subset of the class of grammars that can be parsed with predictive parser (b) What is an activation record? Explain how they are used to access local and global variables. ************* 2

13 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII EXAMINATION WINTER 2015 Subject Code: 1701 Date: 12/12/2015 Subject Name: Compiler Design Time: 10:30am to 1:00pm Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) Define lexeme, token and pattern. Identify the lexemes that make up the tokens in the following program segment. Indicate corresponding token and pattern. void swap (int a, int b) { int k; k = a; a = b; b = k; } (b) Explain Semantic Analysis and Syntax Analysis phases of compiler with suitable example. Also explain the reporting errors by these two phases. Q.2 (a) Write a short note on Symbol Table Management. (b) Construct DFA for following Regular expression. Use firstpos, lastpos and followpos functions to construct DFA. ( a * b * ) * (b) Construct NFA for following Regular Expression using Thomson s Construction. Apply subset construction method to convert into DFA. (a b)*abb Q.3 (a) Construct LL(1) parsing table for the following Grammar: S ( L ) a L L, S S (b) Check whether the following grammar is CLR or not. S Aa bac Bc bba A d B d 1

14 Q.3 (a) Define: Left Recursive. State the rule to remove left recursive from the grammar. Eliminate left recursive from following grammar. S Aa b A Ac Sd f (b) Construct SLR Parsing Table for the following grammar. S 0S0 1S1 10 Q.4 (a) Explain Operator Precedence Parsing method with example. (b) Show syntax directed definition for simple desk calculator. Also show annotated parse tree for 3*5+4n, where n indicates newline. Q.4 (a) Explain LALR parser in detail. Support your answer with example. (b) Give the translation scheme that converts infix to postfix expression for the following grammar and also generate the annotated parse tree for input string E E+T E T T Q.5 (a) Translate following arithmetic expression - ( a * b ) + ( c + d ) - ( a + b + c + d ) into 1] Quadruples 2] Triple 3] Indirect Triple (b) Explain various dynamic storage allocation techniques. Q.5 (a) Explain any three code optimization techniques with example. (b) Explain various issues in design of code generator. ************* 2

15 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII EXAMINATION SUMMER 2015 Subject code: 1701 Date: 01/05/2015 Subject Name: Compiler Design Time: 02.30pm-05.00pm Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) What are regular expressions? Find the regular expression described by DFA {{A,B},{0,1},δ,A,{B}},where δ is detailed in following table. 0 1 A A B B φ A Please note B is accepting state. Describe the language defined by the regular expression. (b) Construct the NFA using thompson s notation for following regular expression and then convert it to DFA. a + (c d) b * f # Q.2 (a) List the errors generated by the syntax analysis phase. Discuss error handling methods in the syntax analysis phase. (b) For the following grammar D T L ; L L, id id T int float 1)Remove left recursion (if required) 2)Find first and follow for each non terminal for Resultant grammar 3)Construct LL(1) parsing table 4)Parse the following string (show stack actions clearly) and draw parse tree for the input: int id, id; (b) How top down and bottom up parser will parse the string bbd using grammar A ba d. Show all steps clearly. 1

16 Q.3 (a) Explain the phases of compiler with an example. (b) Construct the collection of sets of LR(0) items for the following grammar. S-> Aa bac dc bda A->d Q.3 (a) Construct DFA by syntax tree construction method. a + b * (c d) f # Optimize the resultant DFA. (b) Develop a predictive parser for the following grammar. S ->S S->aA b cb d A->aA b B->cB d Q.4 (a) Explain the following: 1) The Handle 2) Left Factoring 3) Directed Acyclic Graph 4) Conflicts in LR Parsing 5) Parser Generator 6) Dependency Graph 7) Locality of reference (b) Construct an SLR Parsing table for the following grammar. E->E-T T T->F T F F->(E) id Q.4 (a) Elaborate the term Activation Record in detail. (b) Discuss various code optimization techniques. Q.5 (a) Write a context free grammar for arithmetic expressions. Develop a syntax directed definition for the grammar. Draw an annotated parse tree for the input expression: (3*2+2)*4 (b) Convert the following statement into triple, indirect triple and quadruple forms. A= (B+C) $ E + (B+C) *F Q.5 (a) Discuss synthesized and inherited attributes using a suitable grammar. (b) What is intermediate code? What is its importance? Discuss various representations of three address code. ************* 2

17 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII EXAMINATION WINTER 2014 Subject Code: 1701 Date: Subject Name: Compiler Design Time: 10:30 am - 01:00 pm Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) Explain Buffer pairs and Sentinels. (b) Draw Transition diagram of following: i. relational operators. ii. unsigned operator. Q.2 (a) Explain recursive-descent and predictive parsing. (b) Construct minimum state DFA s for following regular expressions. i. (a b)*a(a b) ii. (a b)*a(a b) (a b) (b) What do you understand by a handle? Explain the stack implementation of shift reduce parser with the help of example. Q.3 (a) Show that the following grammer S-> AaAb BbBa A -> ϵ B -> ϵ is LL(1) but not SLR(1). (b) Show that the following grammer S->Aa bac dc bda A->d is LALR(1) but not SLR(1). Q.3 (a) Show that the following grammer S->Aa bac Bc bba A->d B->d is LR(1) but not LALR(1). (b) Explain various error recovery strategy of compilers Q.4 (a) Construct a Syntax-Directed Translation scheme that translates arithmetic expressions from intfix into postfix notation. Show the application of your scheme to the string 3*4+5*2. (b) What is the use of a symbol table? How identifiers are stored in the symbol table? Q.4 (a) Explain quadruple, triple and indirecttriple with suitable example. (b) Explain with an appropriate example how to perform bottom up evaluation of an inherited attributes. Q.5 (a) Explain various code optimization technique. (b) Describe algorithm for global common subexpression elimination. Q.5 (a) Explain code generator design issues. (b) Explain Stack allocation and Activation record organization in brief. ************* 1

18 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII EXAMINATION SUMMER 2014 Subject Code: 1701 Date: Subject Name: Compiler Design Time: 02:30 pm - 05:00 pm Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) What is the pass of a compiler? Explain how the single and multi-pass compilers work. (b) Draw Deterministic Finite Automata for : 1. (0+1)*101(0+1)* 2. 10(0+1)*1 Q.2 (a) List out phases of a compiles. Write a brief not on Lexical Analyzer. 06 (b) Implement the following grammar using Table Driven parser and check whether it is 08 LL(1) or not. S -> abdh, B -> cc, C -> bc / ^, D -> EF, E -> g / ^, F-> f / ^ (b) Implement the following grammar using Recursive Descent Parser. S -> Aa bac bba, A -> d, B -> d 08 Q.3 (a) What is bottom-up parsing? Discuss Shift Reduce parsing technique in brief. What is a handle? 08 (b) Write a syntax directed definition of a simple desk calculator and draw an annotated parse tree for 4*3 + 2*5 n. 06 Q.3 (a) Define an Operator Precedence Grammar. Also write down the rules to find relationship between each pair of terminal symbols. 08 (b) Convert the following into quadruple, triple and indirect triple forms : -(a+b)*(c-d). 06 Q.4 (a) Construct SLR parsing table for the following grammar : E->E+T E->T T->T*F T->F F->(E) F->a (b) Differentiate Synthesized and Inherited attributes. 04 Q.4 (a) Error Recovery strategies of compiler. (b) What is the use of a symbol table? How the identifiers are stored in the symbol table? Q.5 (a) Write a note on peephole optimization. (b) Write a note on static and dynamic memory allocation. What do you mean by dangling reference? Q.5 (a) What is an activation record? Explain how they are used to access various local and global variables. (b) Write a brief note on input buffering techniques. ************* 10 1

19 Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER VII EXAMINATION WINTER 2013 Subject Code: 1701 Date: Subject Name: Compiler Design Time: am pm Total Marks: 70 Instructions: 1. Attempt all questions. 2. Make suitable assumptions wherever necessary. 3. Figures to the right indicate full marks. Q.1 (a) Draw structure of Compiler. Also explain Analysis Phase in brief. (b) Draw Deterministic Finite Automata for the binary strings ending with (c) Write down the algorithm for left factoring. 03 Q.2 (a) Write a brief note on input buffering techniques to Lexical Analyzer. (b) Write down C program for Recursive Descend Parser for : S ABC B 1B A 0A1 C 1C0 Q.2 (a) Explain Shift-Reduce parsing with suitable example. (b) Draw parsing table for Table Driven Parser for the given grammar. Is the grammar LL(1)? A AaB x B BCb Cy C Cc Q.3 (a) What is Inherited attribute? Explain with suitable example. 06 (b) Write down steps to set precedence relationship for Operator Precedence Grammar. Design precedence table for: 08 E E+ T T T T * F F F a Q.3 (a) Explain how panic mode recovery can be implemented. (b) What is the difference between parse tree and syntax tree? Write appropriate grammar and draw parse as well as syntax tree for a*(a-a^a) Q.4 (a) Write SLR parsing table for : S T T CC C cc C d 08 (b) Explain Stack Allocation and Activation Record Organization in brief. 06 Q.4 (a) Write a note on Peephole Optimization. 08 (b) Explain quadruple, triple and indirect triple with suitable example 06 Q.5 (a) Explain the roles of linker, loader and preprocessor. 08 (b) Differentiate: static v/s dynamic memory allocations. 03 (c) Write down the regular expression for the binary strings with even length. 03 Q.5 (a) Discuss generic issues in the design of code generation. (b) Write down the algorithm for partitioning of basic blocks. ************* 1

20

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701)

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701) Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov 2014 Compiler Design (170701) Question Bank / Assignment Unit 1: INTRODUCTION TO COMPILING

More information

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram CS6660 COMPILER DESIGN Question Bank UNIT I-INTRODUCTION TO COMPILERS 1. Define compiler. 2. Differentiate compiler and interpreter. 3. What is a language processing system? 4. List four software tools

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY Type of course: System Programming GUJARAT TECHNOLOGICAL UNIVERSITY SYSTEM PROGRAMMING SUBJECT CODE: 21508 B.E. 5 th SEMESTER Prerequisite: Data Structures and Operating Systems Rationale: NA Teaching

More information

Question Bank. 10CS63:Compiler Design

Question Bank. 10CS63:Compiler Design Question Bank 10CS63:Compiler Design 1.Determine whether the following regular expressions define the same language? (ab)* and a*b* 2.List the properties of an operator grammar 3. Is macro processing a

More information

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: CS2352 Principles of Compiler Design Year/Sem : III/VI

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: CS2352 Principles of Compiler Design Year/Sem : III/VI DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: CS2352 Principles of Compiler Design Year/Sem : III/VI UNIT I - LEXICAL ANALYSIS 1. What is the role of Lexical Analyzer? [NOV 2014] 2. Write

More information

DEPARTMENT OF INFORMATION TECHNOLOGY / COMPUTER SCIENCE AND ENGINEERING UNIT -1-INTRODUCTION TO COMPILERS 2 MARK QUESTIONS

DEPARTMENT OF INFORMATION TECHNOLOGY / COMPUTER SCIENCE AND ENGINEERING UNIT -1-INTRODUCTION TO COMPILERS 2 MARK QUESTIONS BHARATHIDASAN ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY / COMPUTER SCIENCE AND ENGINEERING Year & Semester : III & VI Degree & Branch : B.E (CSE) /B.Tech (Information Technology) Subject

More information

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III & VI Section : CSE 1 & 2 Subject Code : CS6660 Subject Name : COMPILER

More information

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING COURSE PLAN

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING COURSE PLAN SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING COURSE PLAN Course Code : CS1014 Semester: VI Course Title : System Software and Compiler Design Course Time:

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 60 20 DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK VI SEMESTER CS6660 COMPILER DESIGN Regulation 20 Academic Year 207 8 Prepared by Ms. S.

More information

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1 Table of Contents About the Authors... iii Introduction... xvii Chapter 1: System Software... 1 1.1 Concept of System Software... 2 Types of Software Programs... 2 Software Programs and the Computing Machine...

More information

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING ACADEMIC YEAR / EVEN SEMESTER

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING ACADEMIC YEAR / EVEN SEMESTER KINGS COLLEGE OF ENGINEERING PUNALKULAM DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING ACADEMIC YEAR 2010-2011 / EVEN SEMESTER SUBJECT CODE\SUBJECT NAME: CS1352 \ PRINCIPLES OF COMPILER DESIGN QUESTION BANK

More information

QUESTIONS RELATED TO UNIT I, II And III

QUESTIONS RELATED TO UNIT I, II And III QUESTIONS RELATED TO UNIT I, II And III UNIT I 1. Define the role of input buffer in lexical analysis 2. Write regular expression to generate identifiers give examples. 3. Define the elements of production.

More information

2068 (I) Attempt all questions.

2068 (I) Attempt all questions. 2068 (I) 1. What do you mean by compiler? How source program analyzed? Explain in brief. 2. Discuss the role of symbol table in compiler design. 3. Convert the regular expression 0 + (1 + 0)* 00 first

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (AUTONOMOUS)

INSTITUTE OF AERONAUTICAL ENGINEERING (AUTONOMOUS) Name Code Class Branch INSTITUTE OF AERONAUTICAL ENGINEERING (AUTONOMOUS) Dundigal, Hyderabad - 500 043 Year 0-0 INFORMATION TECHNOLOGY ASSIGNMENT QUESTIONS AUTOMATA AND COMPILER DESIGN A50513 III B. Tech

More information

Compiler Design Aug 1996

Compiler Design Aug 1996 Aug 1996 Part A 1 a) What are the different phases of a compiler? Explain briefly with the help of a neat diagram. b) For the following Pascal keywords write the state diagram and also write program segments

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 00 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Name AUTOMATA AND COMPILER DESIGN Code A03 Class III B. Tech I Semester Branch

More information

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY G.PULLAI COLLEGE OF ENGINEERING & TECNOLOGY Nandikotkur Road, Kurnool 518002 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Semester VI (2017-2018) COURSE DESCRIPTION Course Code : 15A05601 Course Title

More information

CST-402(T): Language Processors

CST-402(T): Language Processors CST-402(T): Language Processors Course Outcomes: On successful completion of the course, students will be able to: 1. Exhibit role of various phases of compilation, with understanding of types of grammars

More information

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN Course Code : CS0301 Course Title : Compiler Design Semester : V Course Time : July Dec 2011 DAY SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN SECTION

More information

Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/ LANGUAGE PROCESSOR. Time Allotted : 3 Hours Full Marks : 70

Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/ LANGUAGE PROCESSOR. Time Allotted : 3 Hours Full Marks : 70 Name : Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/2011-12 2011 LANGUAGE PROCESSOR Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates

More information

Evaluation Scheme L T P Total Credit Theory Mid Sem Exam

Evaluation Scheme L T P Total Credit Theory Mid Sem Exam DESIGN OF LANGUAGE PROCESSORS Semester II (Computer Engineering) SUB CODE: MECE201 Teaching Scheme (Credits and Hours): Teaching scheme Total Evaluation Scheme L T P Total Credit Theory Mid Sem Exam CIA

More information

LECTURE NOTES ON COMPILER DESIGN P a g e 2

LECTURE NOTES ON COMPILER DESIGN P a g e 2 LECTURE NOTES ON COMPILER DESIGN P a g e 1 (PCCS4305) COMPILER DESIGN KISHORE KUMAR SAHU SR. LECTURER, DEPARTMENT OF INFORMATION TECHNOLOGY ROLAND INSTITUTE OF TECHNOLOGY, BERHAMPUR LECTURE NOTES ON COMPILER

More information

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING DEPARTMENT OF CSE COURSE PLAN Course Code : CS0301 Course Title : Compiler Design Semester : V Course Time

More information

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8]

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] Code No: R05311201 Set No. 1 1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] 2. Compute the FIRST and FOLLOW sets of each

More information

Name of chapter & details

Name of chapter & details Course Title Course Code Compiler Design CE702 Theory : 03 Course Credit Practical : 01 Tutorial : 00 Course Learning Outcomes The objectives of this course are Credits : 04 Improve the theory and practice

More information

KALASALINGAM UNIVERSITY ANAND NAGAR, KRISHNAN KOIL DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING ODD SEMESTER COURSE PLAN

KALASALINGAM UNIVERSITY ANAND NAGAR, KRISHNAN KOIL DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING ODD SEMESTER COURSE PLAN Subject with Code KALASALINGAM UNIVERSITY ANAND NAGAR, KRISHNAN KOIL 626 126 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING ODD SEMESTER 2013-2014 Semester/Branch/Section Credits : 3 COURSE PLAN : Compiler

More information

SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA

SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA Contents i SYLLABUS UNIT - I CHAPTER - 1 : INTRODUCTION Programs Related to Compilers. Translation Process, Major Data Structures, Other Issues in Compiler Structure, Boot Strapping and Porting. CHAPTER

More information

1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail.

1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail. Code No: R05320502 Set No. 1 1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail. 2. Construct predictive parsing

More information

VIVA QUESTIONS WITH ANSWERS

VIVA QUESTIONS WITH ANSWERS VIVA QUESTIONS WITH ANSWERS 1. What is a compiler? A compiler is a program that reads a program written in one language the source language and translates it into an equivalent program in another language-the

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK VI SEMESTER CS6660-COMPILER DESIGN Regulation 2013 Academic Year 2017 18 (Even)

More information

The analysis part breaks up the source program into constituent pieces and creates an intermediate representation of the source program.

The analysis part breaks up the source program into constituent pieces and creates an intermediate representation of the source program. COMPILER DESIGN 1. What is a compiler? A compiler is a program that reads a program written in one language the source language and translates it into an equivalent program in another language-the target

More information

Principles of Programming Languages [PLP-2015] Detailed Syllabus

Principles of Programming Languages [PLP-2015] Detailed Syllabus Principles of Programming Languages [PLP-2015] Detailed Syllabus This document lists the topics presented along the course. The PDF slides published on the course web page (http://www.di.unipi.it/~andrea/didattica/plp-15/)

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY Type of course: Elective SUBJECT NAME: Distributed DBMS SUBJECT CODE: 21714 B.E. 7 th SEMESTER Prerequisite: Database Management Systems & Networking Rationale: Students are familiar with Centralized DBMS.

More information

DEPARTMENT OF INFORMATION TECHNOLOGY AUTOMATA AND COMPILER DESIGN. B.Tech-IT, III Year -I Sem

DEPARTMENT OF INFORMATION TECHNOLOGY AUTOMATA AND COMPILER DESIGN. B.Tech-IT, III Year -I Sem DEPARTMENT OF INFORMATION TECHNOLOGY AUTOMATA AND COMPILER DESIGN B.Tech-IT, III Year -I Sem Dr. Smriti Agrawal Assoc. Professor J.B.Institute of Engg & Technology Yenkapally, Moinabad(Mandal) Himathnagar(post),Hydreabad

More information

PSD3A Principles of Compiler Design Unit : I-V. PSD3A- Principles of Compiler Design

PSD3A Principles of Compiler Design Unit : I-V. PSD3A- Principles of Compiler Design PSD3A Principles of Compiler Design Unit : I-V 1 UNIT I - SYLLABUS Compiler Assembler Language Processing System Phases of Compiler Lexical Analyser Finite Automata NFA DFA Compiler Tools 2 Compiler -

More information

CS606- compiler instruction Solved MCQS From Midterm Papers

CS606- compiler instruction Solved MCQS From Midterm Papers CS606- compiler instruction Solved MCQS From Midterm Papers March 06,2014 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 Final Term MCQ s and Quizzes CS606- compiler instruction If X is a

More information

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, Pilani Pilani Campus Instruction Division

BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, Pilani Pilani Campus Instruction Division SECOND SEMESTER 2015-2016 Course Handout (Part II) Date:23-01-2017 In addition to part I (General Handout for all courses appended to the time table) this portion gives further specific details regarding

More information

Torben./Egidius Mogensen. Introduction. to Compiler Design. ^ Springer

Torben./Egidius Mogensen. Introduction. to Compiler Design. ^ Springer Torben./Egidius Mogensen Introduction to Compiler Design ^ Springer Contents 1 Lexical Analysis 1 1.1 Regular Expressions 2 1.1.1 Shorthands 4 1.1.2 Examples 5 1.2 Nondeterministic Finite Automata 6 1.3

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY GUJARAT TECHNOLOGICAL UNIVERSITY INFORMATION TECHNOLOGY DATA COMPRESSION AND DATA RETRIVAL SUBJECT CODE: 2161603 B.E. 6 th SEMESTER Type of course: Core Prerequisite: None Rationale: Data compression refers

More information

Concepts Introduced in Chapter 3. Lexical Analysis. Lexical Analysis Terms. Attributes for Tokens

Concepts Introduced in Chapter 3. Lexical Analysis. Lexical Analysis Terms. Attributes for Tokens Concepts Introduced in Chapter 3 Lexical Analysis Regular Expressions (REs) Nondeterministic Finite Automata (NFA) Converting an RE to an NFA Deterministic Finite Automatic (DFA) Lexical Analysis Why separate

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY GUJARAT TECHNOLOGICAL UNIVERSITY BRANCH NAME: INSTRUMENTATION & CONTROL ENGINEERING (17) SUBJECT NAME: EMBEDDED SYSTEM DESIGN SUBJECT CODE: 2171711 B.E. 7 th SEMESTER Type of course: Core Engineering Prerequisite:

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

CSCI 565 Compiler Design and Implementation Spring 2014

CSCI 565 Compiler Design and Implementation Spring 2014 CSCI 565 Compiler Design and Implementation Spring 2014 Instructor: Description: Prerequisites: Dr. Pedro C. Diniz, e-mail pedro@isi.edu Lectures: Thursday, 8.00 10.50 AM, RTH 217, phone: (213) 740 4518

More information

Translator Design CRN Course Administration CMSC 4173 Spring 2018

Translator Design CRN Course Administration CMSC 4173 Spring 2018 Document: Translator Design Course Administration Revised: February 7, 2018 Course Title: Translator Design Course Number: CMSC 4173 Section: CRN 25838 Monday and Wednesday 5:45 7:00 p.m. MCS 113 Instructor:

More information

Section A. A grammar that produces more than one parse tree for some sentences is said to be ambiguous.

Section A. A grammar that produces more than one parse tree for some sentences is said to be ambiguous. Section A 1. What do you meant by parser and its types? A parser for grammar G is a program that takes as input a string w and produces as output either a parse tree for w, if w is a sentence of G, or

More information

Translator Design CRN Course Administration CMSC 4173 Spring 2017

Translator Design CRN Course Administration CMSC 4173 Spring 2017 Document: Translator Design Course Administration Revised: January 12, 2015 Course Title: Translator Design Course Number: CMSC 4173 Section: CRN 25838 Thursday 11:00 12:15 p.m. MCS 121 Instructor: Dr.

More information

PRINCIPLES OF COMPILER DESIGN

PRINCIPLES OF COMPILER DESIGN PRINCIPLES OF COMPILER DESIGN 2 MARK QUESTIONS WITH ANSWERS UNIT I 1. What is a Complier? A Complier is a program that reads a program written in one language-the source language-and translates it in to

More information

Final Term Papers 2013

Final Term Papers 2013 Solved by: Sahar (well wisher) Class BSCS 6 th Semester Subject CS606 (COMPILER CONSTRUCTION) Solution Type: Final Term Solved Subjective including Papers of Year : 2013,2012,2011,2010,2009 2006 Institute:

More information

Compilers for Modern Architectures Course Syllabus, Spring 2015

Compilers for Modern Architectures Course Syllabus, Spring 2015 Compilers for Modern Architectures Course Syllabus, Spring 2015 Instructor: Dr. Rafael Ubal Email: ubal@ece.neu.edu Office: 140 The Fenway, 3rd floor (see detailed directions below) Phone: 617-373-3895

More information

QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE. CHAPTER 2: Overview of Language Processors. CHAPTER 3: Assemblers

QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE. CHAPTER 2: Overview of Language Processors. CHAPTER 3: Assemblers QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE 1) Explain Analysis-synthesis model/fron end backend model of compiler 2) Explain various phases of compiler and symbol table. Consider the statement

More information

CS 2210 Sample Midterm. 1. Determine if each of the following claims is true (T) or false (F).

CS 2210 Sample Midterm. 1. Determine if each of the following claims is true (T) or false (F). CS 2210 Sample Midterm 1. Determine if each of the following claims is true (T) or false (F). F A language consists of a set of strings, its grammar structure, and a set of operations. (Note: a language

More information

Compiler Design Overview. Compiler Design 1

Compiler Design Overview. Compiler Design 1 Compiler Design Overview Compiler Design 1 Preliminaries Required Basic knowledge of programming languages. Basic knowledge of FSA and CFG. Knowledge of a high programming language for the programming

More information

CS6660 COMPILER DESIGN L T P C

CS6660 COMPILER DESIGN L T P C COMPILER DESIGN CS6660 COMPILER DESIGN L T P C 3 0 0 3 UNIT I INTRODUCTION TO COMPILERS 5 Translators-Compilation and Interpretation-Language processors -The Phases of CompilerErrors Encountered in Different

More information

General Overview of Compiler

General Overview of Compiler General Overview of Compiler Compiler: - It is a complex program by which we convert any high level programming language (source code) into machine readable code. Interpreter: - It performs the same task

More information

Compiler Construction

Compiler Construction Compiled on 5/05/207 at 3:2pm Abbreviations NFA. Non-deterministic finite automaton DFA. Deterministic finite automaton Compiler Construction Collection of exercises Version May 5, 207 General Remarks

More information

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 20th May 2016 Time: 14:00-16:00

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 20th May 2016 Time: 14:00-16:00 Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Compilers Date: Friday 20th May 2016 Time: 14:00-16:00 Please answer any THREE Questions from the FIVE Questions provided This is a CLOSED

More information

3. Syntax Analysis. Andrea Polini. Formal Languages and Compilers Master in Computer Science University of Camerino

3. Syntax Analysis. Andrea Polini. Formal Languages and Compilers Master in Computer Science University of Camerino 3. Syntax Analysis Andrea Polini Formal Languages and Compilers Master in Computer Science University of Camerino (Formal Languages and Compilers) 3. Syntax Analysis CS@UNICAM 1 / 54 Syntax Analysis: the

More information

ECE251 Midterm practice questions, Fall 2010

ECE251 Midterm practice questions, Fall 2010 ECE251 Midterm practice questions, Fall 2010 Patrick Lam October 20, 2010 Bootstrapping In particular, say you have a compiler from C to Pascal which runs on x86, and you want to write a self-hosting Java

More information

Life Cycle of Source Program - Compiler Design

Life Cycle of Source Program - Compiler Design Life Cycle of Source Program - Compiler Design Vishal Trivedi * Gandhinagar Institute of Technology, Gandhinagar, Gujarat, India E-mail: raja.vishaltrivedi@gmail.com Abstract: This Research paper gives

More information

Working of the Compilers

Working of the Compilers Working of the Compilers Manisha Yadav Nisha Thakran IT DEPARTMENT IT DEPARTMENT DCE,GURGAON DCE,GURGAON Abstract- The objective of the paper is to depict the working of the compilers that were designed

More information

LALR Parsing. What Yacc and most compilers employ.

LALR Parsing. What Yacc and most compilers employ. LALR Parsing Canonical sets of LR(1) items Number of states much larger than in the SLR construction LR(1) = Order of thousands for a standard prog. Lang. SLR(1) = order of hundreds for a standard prog.

More information

Formal Languages and Compilers Lecture VI: Lexical Analysis

Formal Languages and Compilers Lecture VI: Lexical Analysis Formal Languages and Compilers Lecture VI: Lexical Analysis Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/ Formal

More information

UNIT III. The following section deals with the compilation procedure of any program.

UNIT III. The following section deals with the compilation procedure of any program. Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1 UNIT III Role of lexical analysis -parsing & Token, patterns and Lexemes & Lexical Errors, regular definitions for the language constructs & strings,

More information

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Lexical Analysis Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Phase Ordering of Front-Ends Lexical analysis (lexer) Break input string

More information

CS143 Midterm Fall 2008

CS143 Midterm Fall 2008 CS143 Midterm Fall 2008 Please read all instructions (including these) carefully. There are 4 questions on the exam, some with multiple parts. You have 75 minutes to work on the exam. The exam is closed

More information

VETRI VINAYAHA COLLEGE OF ENGINEERING AND TECHNOLOGY

VETRI VINAYAHA COLLEGE OF ENGINEERING AND TECHNOLOGY VETRI VINAYAHA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6660 COMPILER DESIGN III year/ VI sem CSE (Regulation 2013) UNIT I -INTRODUCTION TO COMPILER PART A

More information

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008 Course Syllabus Course Title: Compiler Construction Course Level: 4 Lecture Time: Course

More information

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100 GATE- 2016-17 Postal Correspondence 1 Compiler Design Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts,

More information

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2]

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] 1 What is Lexical Analysis? First step of a compiler. Reads/scans/identify the characters in the program and groups

More information

BSCS Fall Mid Term Examination December 2012

BSCS Fall Mid Term Examination December 2012 PUNJAB UNIVERSITY COLLEGE OF INFORMATION TECHNOLOGY University of the Punjab Sheet No.: Invigilator Sign: BSCS Fall 2009 Date: 14-12-2012 Mid Term Examination December 2012 Student ID: Section: Morning

More information

COLLEGE OF ENGINEERING, NASHIK. LANGUAGE TRANSLATOR

COLLEGE OF ENGINEERING, NASHIK. LANGUAGE TRANSLATOR Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK. LANGUAGE TRANSLATOR By Prof. Anand N. Gharu (Assistant Professor) PVGCOE Computer Dept.. 22nd Jan 2018 CONTENTS :- 1. Role of lexical analysis 2.

More information

COMPILER DESIGN. For COMPUTER SCIENCE

COMPILER DESIGN. For COMPUTER SCIENCE COMPILER DESIGN For COMPUTER SCIENCE . COMPILER DESIGN SYLLABUS Lexical analysis, parsing, syntax-directed translation. Runtime environments. Intermediate code generation. ANALYSIS OF GATE PAPERS Exam

More information

Lecture 7: Deterministic Bottom-Up Parsing

Lecture 7: Deterministic Bottom-Up Parsing Lecture 7: Deterministic Bottom-Up Parsing (From slides by G. Necula & R. Bodik) Last modified: Tue Sep 20 12:50:42 2011 CS164: Lecture #7 1 Avoiding nondeterministic choice: LR We ve been looking at general

More information

UNIT -2 LEXICAL ANALYSIS

UNIT -2 LEXICAL ANALYSIS OVER VIEW OF LEXICAL ANALYSIS UNIT -2 LEXICAL ANALYSIS o To identify the tokens we need some method of describing the possible tokens that can appear in the input stream. For this purpose we introduce

More information

University of Technology Department of Computer Sciences. Final Examination st Term. Subject:Compilers Design

University of Technology Department of Computer Sciences. Final Examination st Term. Subject:Compilers Design Subject:Compilers Design Division: All Branches Examiner:Dr. Abeer Tariq University of Technology Department of Computer Sciences 2102 Final Examination 2011-2012 1 st Term Year:Third Time: 3 Hours Date:

More information

CS131: Programming Languages and Compilers. Spring 2017

CS131: Programming Languages and Compilers. Spring 2017 CS131: Programming Languages and Compilers Spring 2017 Course Information Instructor: Fu Song Office: Room 1A-504C, SIST Building Email: songfu@shanghaitech.edu.cn Class Hours : Tuesday and Thursday, 8:15--9:55

More information

CS143 Handout 20 Summer 2011 July 15 th, 2011 CS143 Practice Midterm and Solution

CS143 Handout 20 Summer 2011 July 15 th, 2011 CS143 Practice Midterm and Solution CS143 Handout 20 Summer 2011 July 15 th, 2011 CS143 Practice Midterm and Solution Exam Facts Format Wednesday, July 20 th from 11:00 a.m. 1:00 p.m. in Gates B01 The exam is designed to take roughly 90

More information

Structure of a compiler. More detailed overview of compiler front end. Today we ll take a quick look at typical parts of a compiler.

Structure of a compiler. More detailed overview of compiler front end. Today we ll take a quick look at typical parts of a compiler. More detailed overview of compiler front end Structure of a compiler Today we ll take a quick look at typical parts of a compiler. This is to give a feeling for the overall structure. source program lexical

More information

Lecture 8: Deterministic Bottom-Up Parsing

Lecture 8: Deterministic Bottom-Up Parsing Lecture 8: Deterministic Bottom-Up Parsing (From slides by G. Necula & R. Bodik) Last modified: Fri Feb 12 13:02:57 2010 CS164: Lecture #8 1 Avoiding nondeterministic choice: LR We ve been looking at general

More information

CS6660-COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS PART A

CS6660-COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS PART A CS6660-COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS PART A 1. What does translator mean? A translator is a program that takes a input program on one programming language (source language) and produces

More information

CS 406/534 Compiler Construction Putting It All Together

CS 406/534 Compiler Construction Putting It All Together CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy

More information

JNTUWORLD. Code No: R

JNTUWORLD. Code No: R Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

More information

Compiler Construction

Compiler Construction Compiler Construction Collection of exercises Version February 7, 26 Abbreviations NFA. Non-deterministic finite automaton DFA. Deterministic finite automaton Lexical analysis. Construct deterministic

More information

CSE 401 Midterm Exam 11/5/10

CSE 401 Midterm Exam 11/5/10 Name There are 5 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed books, closed notes, closed

More information

CS5363 Final Review. cs5363 1

CS5363 Final Review. cs5363 1 CS5363 Final Review cs5363 1 Programming language implementation Programming languages Tools for describing data and algorithms Instructing machines what to do Communicate between computers and programmers

More information

Midterm I (Solutions) CS164, Spring 2002

Midterm I (Solutions) CS164, Spring 2002 Midterm I (Solutions) CS164, Spring 2002 February 28, 2002 Please read all instructions (including these) carefully. There are 9 pages in this exam and 5 questions, each with multiple parts. Some questions

More information

Principles of Compiler Design Presented by, R.Venkadeshan,M.Tech-IT, Lecturer /CSE Dept, Chettinad College of Engineering &Technology

Principles of Compiler Design Presented by, R.Venkadeshan,M.Tech-IT, Lecturer /CSE Dept, Chettinad College of Engineering &Technology Principles of Compiler Design Presented by, R.Venkadeshan,M.Tech-IT, Lecturer /CSE Dept, Chettinad College of Engineering &Technology 6/30/2010 Principles of Compiler Design R.Venkadeshan 1 Preliminaries

More information

EDAN65: Compilers, Lecture 06 A LR parsing. Görel Hedin Revised:

EDAN65: Compilers, Lecture 06 A LR parsing. Görel Hedin Revised: EDAN65: Compilers, Lecture 06 A LR parsing Görel Hedin Revised: 2017-09-11 This lecture Regular expressions Context-free grammar Attribute grammar Lexical analyzer (scanner) Syntactic analyzer (parser)

More information

Compiler Construction: Parsing

Compiler Construction: Parsing Compiler Construction: Parsing Mandar Mitra Indian Statistical Institute M. Mitra (ISI) Parsing 1 / 33 Context-free grammars. Reference: Section 4.2 Formal way of specifying rules about the structure/syntax

More information

Compilers. Computer Science 431

Compilers. Computer Science 431 Compilers Computer Science 431 Instructor: Erik Krohn E-mail: krohne@uwosh.edu Text Message Only: 608-492-1106 Class Time: Tuesday & Thursday: 9:40am - 11:10am Classroom: Halsey 237 Office Location: Halsey

More information

HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS

HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS Code : 6COMTHEORY Prerequisite : 6AMATA Credit : 3 s (3 hours LEC) Year Level: 3 rd year Degree

More information

CSCI Compiler Design

CSCI Compiler Design CSCI 565 - Compiler Design Spring 2015 Midterm Exam March 04, 2015 at 8:00 AM in class (RTH 217) Duration: 2h 30 min. Please label all pages you turn in with your name and student number. Name: Number:

More information

Formal Languages and Compilers Lecture I: Introduction to Compilers

Formal Languages and Compilers Lecture I: Introduction to Compilers Formal Languages and Compilers Lecture I: Introduction to Compilers Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/

More information

Parsing Wrapup. Roadmap (Where are we?) Last lecture Shift-reduce parser LR(1) parsing. This lecture LR(1) parsing

Parsing Wrapup. Roadmap (Where are we?) Last lecture Shift-reduce parser LR(1) parsing. This lecture LR(1) parsing Parsing Wrapup Roadmap (Where are we?) Last lecture Shift-reduce parser LR(1) parsing LR(1) items Computing closure Computing goto LR(1) canonical collection This lecture LR(1) parsing Building ACTION

More information

CS308 Compiler Principles Lexical Analyzer Li Jiang

CS308 Compiler Principles Lexical Analyzer Li Jiang CS308 Lexical Analyzer Li Jiang Department of Computer Science and Engineering Shanghai Jiao Tong University Content: Outline Basic concepts: pattern, lexeme, and token. Operations on languages, and regular

More information

Automatic Scanning and Parsing using LEX and YACC

Automatic Scanning and Parsing using LEX and YACC Available Online at www.ijcsmc.com International Journal of Computer Science and Mobile Computing A Monthly Journal of Computer Science and Information Technology ISSN 2320 088X IMPACT FACTOR: 6.017 IJCSMC,

More information

PART 3 - SYNTAX ANALYSIS. F. Wotawa TU Graz) Compiler Construction Summer term / 309

PART 3 - SYNTAX ANALYSIS. F. Wotawa TU Graz) Compiler Construction Summer term / 309 PART 3 - SYNTAX ANALYSIS F. Wotawa (IST @ TU Graz) Compiler Construction Summer term 2016 64 / 309 Goals Definition of the syntax of a programming language using context free grammars Methods for parsing

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY GUJARAT TECHNOLOGICAL UNIVERSITY Type of course: Engineering SUBJECT NAME: Switch Gear and Protection SUBJECT CODE: 2170908 Prerequisite: Electrical Power Systems II B.E. 7 th SEMESTER Rationale: This

More information

1. The output of lexical analyser is a) A set of RE b) Syntax Tree c) Set of Tokens d) String Character

1. The output of lexical analyser is a) A set of RE b) Syntax Tree c) Set of Tokens d) String Character 1. The output of lexical analyser is a) A set of RE b) Syntax Tree c) Set of Tokens d) String Character 2. The symbol table implementation is based on the property of locality of reference is a) Linear

More information

Context-free grammars

Context-free grammars Context-free grammars Section 4.2 Formal way of specifying rules about the structure/syntax of a program terminals - tokens non-terminals - represent higher-level structures of a program start symbol,

More information