VALLIAMMAI ENGINEERING COLLEGE

Size: px
Start display at page:

Download "VALLIAMMAI ENGINEERING COLLEGE"

Transcription

1 VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK VI SEMESTER CS6660 COMPILER DESIGN Regulation 20 Academic Year Prepared by Ms. S. Jeyalakshmi, Assistant Professor / IT Ms. R. Saranya, Assistant Professor / IT

2 VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur Department of Information Technology Question Bank SUBJECT : CS6660 COMPILER DESIGN SEM / YEAR: VI Sem / III Year UNIT I - INTRODUCTION TO COMPILERS Translators-Compilation and Interpretation-Language processors -The Phases of Compiler-Errors Encountered in Different Phases-The Grouping of Phases-Compiler Construction Tools - Programming Language basics PART-A Q.No Question BTL Competence State any two reasons to why phases of compiler should be grouped. 2 How will you group the phases of compiler? Illustrate diagrammatically how a language is processed. Mention few cousins of compiler. 5 What is a compiler? 6 Differentiate compiler and interpreter. 7 Explain the working of compiler. Analysing 8 Draw the block diagram of compiler. 9 What are the aspects of high level languages which make them preferable over machine language? Analysing 0 Discuss a compiler writing tools. Compare single pass compiler and multi pass compiler Analysing 2 What do you mean by Cross-Compiler? List the various compiler construction tools. Define compiler-compiler. 5 Mention the back-end phases of a compiler.

3 6 List the phases that constitute the front-end of a compiler. BTL-5 Evaluating 7 What are the classifications of compiler? BTL-5 Evaluating 8 What is an interpreter? 9 What are the two parts of a compilation? 20 What is a symbol table? PART-B (i)mention any four compiler construction tools with their benefits and drawbacks.(7) (ii)explain the need for grouping of phases of compiler. (6) (i)define the following terms : Compiler, Interpreter, Translator and difference between them. (8) (ii)describe in detail about Cousins of compiler. (5) Explain in detail the process of compilation. Illustrate the output of each phase of compilation for the input : a = ( b + c ) * ( b + c ) * 2. (i)explain the different phases of a compiler in detail. (0) (ii)discuss the cousins of compiler. () What are the phases of compiler? Explain the phases in detail. Write down the output of each phase for the expression a : = b + c * 50 For the given block structured code, indicate the values assigned to w, x, y and z. int i = ; int j = ; { int i = 5; w = i + j ; } x = i + j ; { int j = 6 ; { i = 7 ; y = i + j ; } z = i + j ; } Explain in detail about the phases of compiler and translate the statement pos := init + rate * 60 (i)explain the various errors encountered in different phases of a compiler in detail. (9) (ii)write notes on Symbol Table. () BTL-5 Evaluating 9 Briefly explain the compiler construction tools

4 0 Explain in detail the front end and back end of the compiler with the help of examples Describe the basics of programming language in brief. 2 For the given block structured code, indicate the values assigned to w, x, y and z. int w, x, y, z; int i = ; j = 5 ; { int j = 7; i = 6 ; w = i + j ; } x = i + j ; { int i = 8 ; y = i + j ; } z = i + j ; Explain in detail the fundamental language processing activities. State the necessity for the compiler in conventional programming language PART - C 2 For the given block structured code, assuming the usual static scoping of declarations, give the scope for each of the twelve declarations. { int w, x, y, z ; /* Block B */ { int x, z ; /* Block B2 */ { int w, x ; /* Block B */ } } { int w, x ; /* Block B */ { int y, z ; /* Block B5 */ } } } For the given block structured code, assuming the usual static scoping of declarations, give the scope for each of the declarations. main() { int a = ; /* Block B */ int b = ; { int b = 2; /* Block B2 */ { int a = ; /* Block B */ cout << a << b ; } { int b = ; /* Block B */ cout << a << b ; } cout << a << b ; } cout << a << b; }

5 i.what advantages are there to a language-processing system in which the compiler produces assembly language rather than machine language? ( 7 ) ii. Describe the types of errors occurring in different phases of compiler? ( 8 ) Explain in detail the issues in the design of compilers. UNIT II - LEXICAL ANALYSIS Need and Role of Lexical Analyzer-Lexical Errors-Expressing Tokens by Regular Expressions-Converting Regular Expression to DFA- Minimization of DFA-Language for Specifying Lexical Analyzers-LEX-Design of Lexical Analyzer for a sample Language. PART-A Q.No Question BTL Competence What is the role of lexical analyser? 2 Define Lexeme 5 Write a regular definition to represent date in the following format : JAN-5 th 20. Write regular expression to describe a language consists of strings made of even numbers a and b. Why is buffering used in lexical analysis? What are the commonly used buffering methods? 6 What are the various parts in LEX program? 7 Differentiate NFA and DFA. Analysing 8 Write regular expression for the following language (i) set of statements over {a,b,c} that contain no two consecutive b's (ii) set of statements over {a,b,c} that contain an even no. of a's 9 Write a grammar for branching statements. 0 Write regular expression for number and identifier. Give the transition diagram for an identifier. 2 List the operations on languages. Construct NFA for the regular expression ( a a * ) / ( b b * ). How can NFA be generated from regular expression. Analysing 5 Write short notes on LEX. BTL-5 Evaluating 6 List the various error recovery strategies for a lexical analysis. BTL-5 Evaluating

6 7 Mention the various notational shorthands for representing regular expressions. 8 Define kleene closure and positive closure. Analysing 9 Describe the language denoted by the regular expression: (i) ( 0 / ) * 0 ( 0 / ) ( 0 / ) (ii) 0 ( 0 / ) * 0 20 What are the models of LEX compiler? PART-B Prove that the following two regular expressions are equivalent by showing that the minimum state DFA's are same : (i) ( a / b ) * (ii) ( a * / b * ) * BTL-5 Evaluating 2 Describe the error recovery schemes in the lexical phase of a compiler (i)explain a language for specifying the lexical analyzer. (7) (ii)explain specification and recognition of tokens. (6) (i)draw the DFA for the augmented regular expression directly using syntax tree ( a / b ) * a b b ( a / b ) * #. (9) (ii)discuss input buffering in detail. () (i)explain in detail about the Lexical analyzer with the possible error recovery actions. (7) (ii)elaborate specification of tokens. (6) Compare NFA and DFA. Construct a DFA directly from an augmented regular expression ( ( ε / a ) b * ) * (i)what are the issues in Lexical analysis. () (ii)differentiate between lexeme, token and pattern. () (iii)draw the transition diagram for relational operators and unsigned numbers. (6) (i)explain briefly about input buffering in reading the source program for finding the tokens. (6) (ii)construct the minimized DFA for the regular expression: (7) ( 0 + ) * ( 0 + ) 0 Construct DFA from an augmented regular expression ( a / b ) * a ( a / b ) ( a / b ). Write down the algorithm wherever necessary. For the regular expression ( a / b ) * a b b ( a / b ) * draw the DFA from NFA. Minimize DFA using Πnew construction. Write down the algorithm wherever necessary (i)describe in detail the tool for generating lexical analyzer. (7) (ii)draw NFA for the regular expression a b * / a b. (6) Convert the Regular Expression a b b ( a / b ) * to DFA using direct method and minimize it. (i)conversion of regular expression ( a / b ) * a b b to NFA. (7) (ii)write an algorithm for minimizing the number of states of a DFA. ( 6 )

7 (i)write notes on regular expression to NFA. Construct Regular expression to NFA for the sentence ( a b ) * a b. (5) (ii)construct DFA to recognize the language ( a / b ) * a b. ( 8 ) PART - C i.discuss the role of lexical analyzer in detail with necessary examples. ( 8 ) ii.discuss how finite automata is used to represent tokens and perform lexical analysis with examples. (7) 2 Explain in detail the Lexical-Analyzer Generator Lex with Lex program structure and example Lex program Write the algorithm for converting a Regular Expression directly to a DFA and also explain the computation of four functions involved and construction of syntax tree and Dtrans Write the algorithm for conversion of Regular Expression to NFA, NFA to DFA and minimization of DFA UNIT III - SYNTAX ANALYSIS Need and Role of the Parser-Context Free Grammars -Top Down Parsing -General Strategies-Recursive Descent Parser Predictive Parser-LL() Parser-Shift Reduce Parser-LR Parser-LR (0)Item-Construction of SLR Parsing Table - Introduction to LALR Parser - Error Handling and Recovery in Syntax Analyzer-YACC-Design of a syntax Analyzer for a Sample Language PART-A Q.No Question BTL Competence What is the role of a parser? 2 Write a CF grammar to represent palindrome. Eliminate the left recursion for the grammar S A a b A A c S d ϵ Eliminate the left recursion from the following grammar A A c A a d b d ϵ 5 What are the various conflicts that occur during Shift Reduce parsing. BTL-5 Evaluating 6 Write the rule to eliminate the left recursion in a grammar. 7 Define an ambiguous grammar. 8 Construct a parse tree for - ( id + id ). 9 Define handle pruning.

8 0 Construct a parse tree of ( a + b ) * c for the grammar E E + E E * E ( E ) id. Eliminate immediate left recursion from the following grammar E E + T T, T T * F F, F ( E ) id. BTL-5 Evaluating 2 What is LR parser? How LR parser is different from SLR? How error recovery is done in LR parsing? Analysing 5 Write algorithm to compute FIRST of a non-terminal. 6 Write algorithm to compute FOLLOW of a non-terminal. 7 How parsing techniques are classified? 8 Define regular grammar. 9 Define context free grammar. 20 How YACC handles different types of conflicts in parser? PART-B 2 5 Generate SLR parsing table for the following grammar S Aa bac Bc bba A d B d And parse the sentence "bdc" and "dd" (i)write down the algorithm to eliminate left-recursion and left-factoring and apply both to the following grammar. (6) E E + T E - T T T a b ( E ) (ii)construct predictive parsing table for the above grammar and parse (a+b)-a (7) Find the LALR for the given grammar and parse the sentence ( a + b ) * c E E + T T, T T * F F, F ( E ) / id. Consider the following grammar S AS b A SA a Construct the SLR parse table for the grammar. Show the actions of the parser for the input string "abab" What is an ambiguous grammar? Is the following grammar ambiguous? Prove. E E + E E * E ( E ) id BTL-5 Evaluating

9 Design an LALR parser for the following grammar and parse the input id = id. S L = R R L * R id R L Construct a predictive parser for the following grammar S ( L ) a L L,S S and show whether the following string will be accepted or not. ( a, ( a, ( a, a ) ) ) (i)construct a non recursive predictive parsing table for the following grammar : E E or E E and E not E ( E ) 0 (9) (ii)construct parse tree for the input string w = c a d using top down parser. S -> c A d, A -> a b a. () Construct SLR parsing table for the following grammar E E + T T T T F F F F * a b Construct a canonical parsing table for the grammar given below. Also explain the algorithm used. E E + T E T T T * F T F F ( E ) F id. (i)construct Stack implementation of shift reduce parsing for the grammar E E + E E * E ( E ) id and the input string is id + id2 * id (6) (ii)explain LL() grammar for the sentence : (7) S -> iets ietses a, E -> b. 2 Explain LR parsing algorithm with an example Construct parsing table for the grammar and find moves made by predictive parser on input id + id * id and find FIRST and FOLLOW. E -> E + T E -> T T -> T * F T -> F F -> ( E ) / id (i)explain ambiguous grammar G : E -> E + E E * E ( E ) - E id for the sentence : id + id * id (5) (ii)construct SLR parsing table for the following grammar G : E -> E + T T, T -> T * F F, F -> ( E ) id. (8)

10 PART - C 2 i.write an algorithm for Non recursive predictive parsing. ( 8 ) ii.explain Context free grammar with examples. ( 7 ) State how to resolve the parsing action conflicts in Shift Reduce parser with an example i.list all LR(0) items for the following grammar ( 8 ) S AS b A SA a ii.write the algorithm for FIRST and FOLLOW computation. ( 7 ) Explain in detail the Parser Generator YACC and YACC specification of a simple desk calculator UNIT IV - SYNTAX DIRECTED TRANSLATION & RUN TIME ENVIRONMENT Syntax directed Definitions-Construction of Syntax Tree-Bottom-up Evaluation of S-Attribute Definitions- Design of predictive translator - Type Systems-Specification of a simple type checker-equivalence of Type Expressions-Type Conversions PART-A Q.No Question BTL Competence Construct a parse tree according to the syntax directed definition, for the following input statement : ( * ) / 2 2 Write the -address code for : x = *y; a = &x. Place the above generated -address code for x = *y; a = &x, in Triplets and indirect Triplets List out the various storage allocation strategies 5 What are the types of intermediate languages? 6 Compare syntax tree and parse tree. 7 What is the significance of intermediate code? 8 When does Dangling references occur? Analysing 9 What is DAG? BTL-5 Evaluating 0 Translate the arithmetic expression a * - ( b + c ) into syntax tree and postfix notation. What do you mean by binding of names? 2 Give examples for static check. List Dynamic Storage allocation techniques. BTL-5 Evaluating

11 Mention the role of semantic analysis. 5 Draw syntax tree for the expression a = b * -c + b * -c 6 Write down syntax directed definition of a simple desk calculator. 7 List out the motivations for backpatching. 8 What are the types of three address statements? Analysing 9 Mention the two rules for type checking. Analysing 20 What are the limitations of static allocation? PART-B (i)give a syntax-directed definition to differentiate expressions formed by applying the arithmetic operators + and * to the variable x and constants ; expression : x * ( * x + x * x ). (7) (ii)how names can be looked up in the symbol table? Discuss. (6) For the given program fragment A[i,j] = B[i,k] do the following : (i)draw the annotated parse tree with the translation scheme to convert to three address code. (5) (ii)write the -address code. (5) (iii) Determine the address of A[,5] where all are integer arrays with size of A as 0 x 0 and B as 0 x 0 with k=2 and the start index position of all arrays is at. ( Assume the base addresses ) () Generate intermediate code for the following code segment along with the required syntax directed translation scheme. while ( i < 0 ) if ( i % 2 == 0 ) evensum = evensum + i else oddsum = oddsum + i Generate intermediate code for the following code segment along with the required syntax directed translation scheme. s = s + a[i][j]; How would you convert the following into intermediate code? Give suitable example (i)assignment statements and use the scheme for generating three address code for g := a + b - c * d. (7) (ii)case statements. (6) (i)explain the sequence of stack allocation processes for a function call. (7) (ii)explain about various parameter passing methods in procedure calls. (6)

12 (i)write the translation scheme for flow of control statement. (7) (ii)explain and compare in detail the various implementation forms of three address code. (6) (i)write the grammar and translation scheme for procedure call statements.(7) (ii)discuss runtime storage management in detail. (6) (i)specify a type checker which can handle expressions, statements and functions. (7) (ii)write down the translation scheme to generate three address for the assignment statements. (6) (i)translate the following switch statement into intermediate code. (7) switch E begin case V : S case V2 : S2 case Vn- : Sn- default : Sn end (ii)generate three address code for the boolean expression. (6) a < b or c < d and e < f (i)a Syntax-Directed Translation scheme that takes strings of a's, b's and c's as input and produces as output the number of substrings in the input string that correspond to the pattern a ( a b ) * c + ( a b ) * b. For example the translation of the input string " a b b c a b c a b a b c " is " ". (7) () Write a context-free grammar that generates all strings of a's, b's and c's (2) Give the semantic attributes for the grammar symbols () For each production of the grammar present a set of rules for evaluation of the semantic attributes (ii)illustrate type checking with necessary diagram. (6) Explain the following with respect to code generation phase. (i) Input to code generator, (ii) Target program, (iii) Memory management, (iv) Instruction Selection, (v) register allocation (vi) Evaluation Order (i)construct a syntax directed definition for constructing a syntax tree for assignment statements. (7) S -> id := E, E -> E + E2, E -> E * E2, E -> -E, E -> ( E ), E -> id (ii)discuss specification of a simple type checker. (6) BTL-5 Evaluating Discuss different storage allocation strategies PART - C Translate the executable statements of the following C program into three address code main( ) {

13 2 int i, a[0]; i = ; while ( i <= 0 ) { a[i] = 0; i = i + ; } } Generate annotated parse tree for the expression c + a[i][j] and also generate three address instruction State the rules for type checking and explain type conversions BTL-5 Evaluating Compare and contrast Quadruples, triples and indirect triples. Give examples UNIT V - CODE OPTIMIZATION AND CODE GENERATION Principal Sources of Optimization-DAG- Optimization of Basic Blocks-Global Data Flow Analysis-Efficient Data Flow Algorithms-Issues in Design of a Code Generator - A Simple Code Generator Algorithm. PART-A Q.No Question BTL Competence How is Liveness of a variable calculated? 2 Generate code for the following C statement assuming three registers are available : x = a / ( b + c ) - d * ( e + f ). Write the algorithm that orders the DAG nodes for generating optimal target code. Differentiate between basic block and flow graph. 5 Draw DAG to represent a[i] = b[i]; a[i] = & t 6 Represent the following in flow graph: i = ; sum = 0; while ( i <= 0 ) { sum += i; i++; } 7 What is global data flow analysis? 8 Name the techniques in loop optimization. 9 Explain why code optimization is called optional phase. BTL-5 Evaluating 0 Draw DAG for the statement a= ( a * b + c ) ( a * b + c ) Define basic blocks. 2 Give any four applications of DAG.

14 What are the properties of optimizing compilers? Analysing What is constant folding? Analysing 5 List the advantages of DAG. 6 Identify the constructs for optimization in basic block. Analysing 7 What do you mean by copy propagation? 8 What are the characteristics of peephole optimization? 9 Write three address code sequence for the assignment statement : d := ( a - b ) + ( a - c ) + ( a - c ) BTL-5 Evaluating 20 List out the criteria for code improving transformations. PART-B 2 5 (i)write the Code Generation Algorithm using Dynamic Programming and generate code for the statement x = a / ( b - c ) - g * ( e + f ). [ Assume all instructions to be unit cost ] (0) (ii)what are the advantages of DAG representation? Give example. () (i)write the procedure to perform Register Allocation and Assignment with Graph Coloring. (7) (ii)construct DAG and optimal target code for the expression (6) x = ( ( a + b ) / ( b - c ) ) - ( a + b ) * ( b - c ) + /. Perform analysis of available expressions on the following code by converting into basic blocks and compute global common sub expression elimination (i) i : = 0 (ii) a : = n - (iii) IF i < a THEN loop ELSE end (iv) LABEL loop (v) b : = I - (vi) c : = p + b (vii) d : - M[c] (viii) e : = d - 2 (ix) f : = i (x) g : = p + f (xi) M[g] : = e (xii) i : - i + (xiii) a : = n (xiv) IF i < a THEN loop ELSE end (xv) LABEL end (i)explain in detail about optimization of Basic Blocks. (7) (ii)what are the optimization techniques applied on procedure calls? Explain with example. (6) (i)generate DAG representation of the following code and list out the applications of DAG representation. (7) i = : while ( i <= 0 ) do sum += a[i]; (ii)explain - Generating code from DAG with suitable example. (6) Analysing

15 6 Explain peephole optimization and various code improving transformations Define a DAG. Construct a DAG and write the sequence of instructions for the expression : a + a * ( b - c ) + ( b - c ) * d (i)draw the DAG for the following three address code. (7) d = b * c e = a + b b = b * c a = e - d (ii)write short notes on structure preserving transformation of basic blocks.(6) Construct DAG and three address code for the following C program i = ; s = 0; while ( i <= 0 ) { s = s + a [i][i] i = i + ; } BTL-5 Evaluating 0 Explain global data flow analysis with necessary equations For the flow graph shown below, write the three address statements and construct the DAG. () t : = * i (2) t2 : = a[ t] () t := * i () t := b[t] (5) t5 := t2 * t (6) t6 := prod + t5 (7) prod := t6 (8) t7 := i + (9) i : = t7 (0) if i <= 20 goto () 2 Explain Principal Sources of Optimization with examples Explain various issues in the design of code generator. (i)write an algorithm for constructing natural loop of a back edge. (7) (ii)write note on simple code generator (6) PART - C Explain the data-flow analysis of structured programs. 2 Explain any four issues that crop up when designing a code generator Generate code for the following assignment using the code generator: ( a b ) + ( a c ) + ( a c ) Write global common subexpression elimination algorithm with example

16 Verified by :. 2. [ ] [ ].. [ ] [ ] Forwarded by Year Coordinator : Approved by HOD :

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

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

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

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

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 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

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

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

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

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

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY Type of course: Core GUJARAT TECHNOLOGICAL UNIVERSITY SUBJECT NAME: Compiler Design SUBJECT CODE: 21701 B.E. 7 th SEMESTER Prerequisite: Data Structures and Algorithms, Theory of Computation, Rationale:

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

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

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

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

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

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

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

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

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

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

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

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK VIII SEMESTER IT6012- TCP/IP DESIGN AND IMPLEMENTATION Regulation 2013 Academic Year

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

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

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

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

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

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK VII SEMESTER

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK VII SEMESTER VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK VII SEMESTER CS6007-INFORMATION RETRIEVAL Regulation 2013 Academic Year 2018

More information

Formal Languages and Compilers Lecture VII Part 3: Syntactic A

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

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF INFORMATION TECHNOLOGY QUESTION BANK III SEMESTER CS8391-Data Structures Regulation 2017 Academic Year 2018 19(odd Semester)

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

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

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

List of Figures. About the Authors. Acknowledgments

List of Figures. About the Authors. Acknowledgments List of Figures Preface About the Authors Acknowledgments xiii xvii xxiii xxv 1 Compilation 1 1.1 Compilers..................................... 1 1.1.1 Programming Languages......................... 1

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

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

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

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

COMPILER DESIGN UNIT I LEXICAL ANALYSIS. Translator: It is a program that translates one language to another Language.

COMPILER DESIGN UNIT I LEXICAL ANALYSIS. Translator: It is a program that translates one language to another Language. UNIT I LEXICAL ANALYSIS Translator: It is a program that translates one language to another Language. Source Code Translator Target Code 1. INTRODUCTION TO LANGUAGE PROCESSING The Language Processing System

More information

1. INTRODUCTION TO LANGUAGE PROCESSING The Language Processing System can be represented as shown figure below.

1. INTRODUCTION TO LANGUAGE PROCESSING The Language Processing System can be represented as shown figure below. UNIT I Translator: It is a program that translates one language to another Language. Examples of translator are compiler, assembler, interpreter, linker, loader and preprocessor. Source Code Translator

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

Compiler Construction Using

Compiler Construction Using Compiler Construction Using Java, JavaCC, and Yacc ANTHONY J. DOS REIS Stale University ofnew York at New Pallz IEEE computer society WILEY A JOHN WILEY & SONS, INC., PUBLICATION Preface xv Chapter 1 Strings,

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

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

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

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

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING QUESTION BANK VII SEMESTER EC6013 Advanced Microprocessors and Microcontrollers

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

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

UNIT III & IV. Bottom up parsing

UNIT III & IV. Bottom up parsing UNIT III & IV Bottom up parsing 5.0 Introduction Given a grammar and a sentence belonging to that grammar, if we have to show that the given sentence belongs to the given grammar, there are two methods.

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

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

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

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 60 20 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E I SEMESTER GE85- Problem Solving and Python Programming Regulation 207 Academic

More information

SEM / YEAR : VI / III CS2352 PRINCIPLES OF COMPLIERS DESIGN UNIT I - LEXICAL ANALYSIS PART - A

SEM / YEAR : VI / III CS2352 PRINCIPLES OF COMPLIERS DESIGN UNIT I - LEXICAL ANALYSIS PART - A SEM / YEAR : VI / III CS2352 PRINCIPLES OF COMPLIERS DESIGN UNIT I - LEXICAL ANALYSIS PART - A 1. What is a compiler? (A.U Nov/Dec 2007) A compiler is a program that reads a program written in one language

More information

Syntax Analysis Part I

Syntax Analysis Part I Syntax Analysis Part I Chapter 4: Context-Free Grammars Slides adapted from : Robert van Engelen, Florida State University Position of a Parser in the Compiler Model Source Program Lexical Analyzer Token,

More information

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 60 0 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK III SEMESTER CS89- DATA STRUCTURES Regulation 07 Academic Year 08 9 Prepared by

More information

Appendix Set Notation and Concepts

Appendix Set Notation and Concepts Appendix Set Notation and Concepts In mathematics you don t understand things. You just get used to them. John von Neumann (1903 1957) This appendix is primarily a brief run-through of basic concepts from

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

4. Lexical and Syntax Analysis

4. Lexical and Syntax Analysis 4. Lexical and Syntax Analysis 4.1 Introduction Language implementation systems must analyze source code, regardless of the specific implementation approach Nearly all syntax analysis is based on a formal

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

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK IV SEMESTER EC6504 MICROPROCESSOR AND MICROCONTROLLER Regulation 2013 Academic

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

Downloaded from Page 1. LR Parsing

Downloaded from  Page 1. LR Parsing Downloaded from http://himadri.cmsdu.org Page 1 LR Parsing We first understand Context Free Grammars. Consider the input string: x+2*y When scanned by a scanner, it produces the following stream of tokens:

More information

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! [ALSU03] Chapter 3 - Lexical Analysis Sections 3.1-3.4, 3.6-3.7! Reading for next time [ALSU03] Chapter 3 Copyright (c) 2010 Ioanna

More information

4. Lexical and Syntax Analysis

4. Lexical and Syntax Analysis 4. Lexical and Syntax Analysis 4.1 Introduction Language implementation systems must analyze source code, regardless of the specific implementation approach Nearly all syntax analysis is based on a formal

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

Bottom-Up Parsing. Lecture 11-12

Bottom-Up Parsing. Lecture 11-12 Bottom-Up Parsing Lecture 11-12 (From slides by G. Necula & R. Bodik) 9/22/06 Prof. Hilfinger CS164 Lecture 11 1 Bottom-Up Parsing Bottom-up parsing is more general than topdown parsing And just as efficient

More information

Wednesday, September 9, 15. Parsers

Wednesday, September 9, 15. Parsers Parsers What is a parser A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure of a program (think: diagramming a sentence) Agenda

More information

Parsers. What is a parser. Languages. Agenda. Terminology. Languages. A parser has two jobs:

Parsers. What is a parser. Languages. Agenda. Terminology. Languages. A parser has two jobs: What is a parser Parsers A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure of a program (think: diagramming a sentence) Agenda

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

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

Bottom-Up Parsing. Lecture 11-12

Bottom-Up Parsing. Lecture 11-12 Bottom-Up Parsing Lecture 11-12 (From slides by G. Necula & R. Bodik) 2/20/08 Prof. Hilfinger CS164 Lecture 11 1 Administrivia Test I during class on 10 March. 2/20/08 Prof. Hilfinger CS164 Lecture 11

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

Parsers. Xiaokang Qiu Purdue University. August 31, 2018 ECE 468

Parsers. Xiaokang Qiu Purdue University. August 31, 2018 ECE 468 Parsers Xiaokang Qiu Purdue University ECE 468 August 31, 2018 What is a parser A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure

More information

Conflicts in LR Parsing and More LR Parsing Types

Conflicts in LR Parsing and More LR Parsing Types Conflicts in LR Parsing and More LR Parsing Types Lecture 10 Dr. Sean Peisert ECS 142 Spring 2009 1 Status Project 2 Due Friday, Apr. 24, 11:55pm The usual lecture time is being replaced by a discussion

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

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

Monday, September 13, Parsers

Monday, September 13, Parsers Parsers Agenda Terminology LL(1) Parsers Overview of LR Parsing Terminology Grammar G = (Vt, Vn, S, P) Vt is the set of terminals Vn is the set of non-terminals S is the start symbol P is the set of productions

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK V SEMESTER CS6502-OBJECT ORIENTED ANALYSIS AND DESIGN Regulation 2013 Academic

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

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

UNIT I INTRODUCTION TO COMPILING

UNIT I INTRODUCTION TO COMPILING UNIT I INTRODUCTION TO COMPILING 1. Define compiler? A compiler is a program that reads a program written in one language (source language) and translates it into an equivalent program in another language

More information

MidTerm Papers Solved MCQS with Reference (1 to 22 lectures)

MidTerm Papers Solved MCQS with Reference (1 to 22 lectures) CS606- Compiler Construction MidTerm Papers Solved MCQS with Reference (1 to 22 lectures) by Arslan Arshad (Zain) FEB 21,2016 0300-2462284 http://lmshelp.blogspot.com/ Arslan.arshad01@gmail.com AKMP01

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

4. An interpreter is a program that

4. An interpreter is a program that 1. In an aboslute loading scheme, which loader function is accomplished by programmer? A. Allocation B. LInking C. Reallocation D. both (A) and (B) 2. A compiler program written in a high level language

More information

Chapter 3: Lexing and Parsing

Chapter 3: Lexing and Parsing Chapter 3: Lexing and Parsing Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Lexing and Parsing* Deeper understanding

More information

NARESHKUMAR.R, AP\CSE, MAHALAKSHMI ENGINEERING COLLEGE, TRICHY Page 1

NARESHKUMAR.R, AP\CSE, MAHALAKSHMI ENGINEERING COLLEGE, TRICHY Page 1 SEM / YEAR : VI / III CS2352 PRINCIPLES OF COMPLIERS DESIGN UNIT III INTERMEDIATE CODE GENERATION PART A 1. What are the benefits of intermediate code generation? (A.U May 2008) A Compiler for different

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

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA.

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA. R13 SET - 1 III B. Tech I Semester Regular Examinations, November - 2015 1 a) What constitutes a programming environment? [3M] b) What mixed-mode assignments are allowed in C and Java? [4M] c) What is

More information

CS 164 Handout 11. Midterm Examination. There are seven questions on the exam, each worth between 10 and 20 points.

CS 164 Handout 11. Midterm Examination. There are seven questions on the exam, each worth between 10 and 20 points. Midterm Examination Please read all instructions (including these) carefully. Please print your name at the bottom of each page on the exam. There are seven questions on the exam, each worth between 10

More information

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology exam Compiler Construction in4303 April 9, 2010 14.00-15.30 This exam (6 pages) consists of 52 True/False

More information

Time : 1 Hour Max Marks : 30

Time : 1 Hour Max Marks : 30 Total No. of Questions : 6 P4890 B.E/ Insem.- 74 B.E ( Computer Engg) PRINCIPLES OF MODERN COMPILER DESIGN (2012 Pattern) (Semester I) Time : 1 Hour Max Marks : 30 Q.1 a) Explain need of symbol table with

More information

CJT^jL rafting Cm ompiler

CJT^jL rafting Cm ompiler CJT^jL rafting Cm ompiler ij CHARLES N. FISCHER Computer Sciences University of Wisconsin Madison RON K. CYTRON Computer Science and Engineering Washington University RICHARD J. LeBLANC, Jr. Computer Science

More information

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur-603203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Academic Year: 2015-16 QUESTION BANK - EVEN SEMESTER Year & Semester : II year & IV sem Section

More information

Midterm I - Solution CS164, Spring 2014

Midterm I - Solution CS164, Spring 2014 164sp14 Midterm 1 - Solution Midterm I - Solution CS164, Spring 2014 March 3, 2014 Please read all instructions (including these) carefully. This is a closed-book exam. You are allowed a one-page handwritten

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