• HOME
  • TEACHING
  • NOTES
  • CONTACT
  • LINKS

Compiler Laboratory

Logistics

  • Classroom and Time
    3rd Year Lab, Tuesdays 02:00pm -05:00pm
  • TAs
    • Shuvendu Rana
    • V. N. Kalyan
    • Sumit Kumar
    • Devendra Malviya
    • Lat Saheb
    • Hardeep
    • Saurabh Gupta
    • Nimit M.D.
    • Simarjot Kaur
  • Evaluation
    After every programming assignment, you are expected to get your code evaluated. There will be a viva after each assignment.
    Cheating implies F. In addition, all cheating cases will be refered to academic affairs for further action.

Assignments

    You will be designing a language and building a compiler for it in this course. This task will be broken down into a series of assignments. Your compiler is required to generate MIPS code which can be run on a MIPS simulator.
    The language you design must have the following features
    • Global declarations for both functions and variables
    • Usual mathematical expressions (bracketing, +, -, *, /, unary negation)
    • Have Integers and Boolean types
    • Looping options
    • Conditionals
    • Should allow all kinds of nesting.
    • Type checking.
    • Input/Output commands
    • Recursion.
  • Assignment 01 Due on Jan 20th
  • Write a C program to do the following:
    Input: A regular expression on the alphabet {a,b}.
    Output: The minimal DFA for the regular expression

    In addition, you must write a program to simulate the DFA on any possible input.
  • Assignment 02 Due on Feb 9th
  • Write the grammar(tentative) for the language you've designed. The language you've designed should be presented at a .txt or .pdf file. Identify the tokens. Write a lex code which will produce the tokens for your language.
  • Assignment 03 Due on March 24th
  • a) Write a parser for the language you've designed. You are allowed to modify the grammar and language but be prepared with the justifications for the changes you make. Your parser should identify the multiple syntax errors.

    b)Write a program to display the syntax tree corresponding to a syntactically correct program.

  • Assignment 04 Due on April 6th
  • In this assignment modify your parser to produce the MIPS machine codes in case of syntactically correct programs. You can break it into 3 smaller assignments

    a) Modify the parser to produce the MIPS code assuming that the program is a simple program without branching statements or loops or function calls.

    b) Add branching statements and loops to the language.

    c) Add function calls.

Announcements

Last modified: Sun Mar 15 23:51:37 IST 2015