Compiler Design (BTCS 601-18) - Theory

Detailed Contents

UNIT 1: Introduction to Compilers

UNIT II: Syntax Analysis

UNIT III: Intermediate Code Generation

UNIT IV: Run-Time Environment and Code Generation

UNIT V: Code Optimization

Course Outcomes

After undergoing this course, the students will be able to:

Suggested Readings/Books


Compiler Design Lab (BTCS 604-18)

List of Experiments

  1. Design a lexical analyzer for a given language. The lexical analyzer should ignore redundant spaces, tabs, and new lines. It should also ignore comments. 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 recognize strings under 'a', 'a*b+', 'abb'.
  4. Write a C program to test whether a given identifier is valid or not.
  5. Write a C program to simulate a lexical analyzer for validating operators.
  6. Implement the lexical analyzer using JLex, flex, or other lexical analyzer generating tools.
  7. Write a C program for implementing the functionalities of a predictive parser for the mini language specified in Note 1.
    1. Write a C program for constructing LL(1) parsing.
    2. Write a C program for constructing recursive descent parsing.
  8. Write a C program to implement LALR parsing.
    1. Write a C program to implement operator precedence parsing.
    2. Write a C program to implement program semantic rules to calculate the expression that takes an expression with digits, +, and * and computes the value.
  9. Convert the BNF rules into YACC form and write code to generate an abstract syntax tree for the mini language specified in Note 1.
  10. Write a C program to generate machine code from the abstract syntax tree generated by the parser. The instruction set specified in Note 2 may be considered as the target code.