Compile the compiler using the ant command


Assignment Task: The Espresso Compiler Project

Question:

You are of course free to do things in which ever order you like, but I suggest the following approach.

  • Read through the grammar.
  • Using the grammar rules, pick out all the terminals and compile a list of them, in the right order, with their names.
  • Finish the flex file by adding in all the missing terminals; use the examples already given in the file to get the syntax correct.
  • Add all terminals to the CUP file in the right order, and remember they are all of type Token.
  • Add all the non-terminals to the CUP file. Since we are not building a parse tree in this phase, simply use the type AST as the type of all the non-terminals. We will refine this when we start building the parse tree in the next phase.
  • Add the productions according to the grammar (see below how to interpret the grammar).

Do not construct any parse tree at this time. You may leave the action part of the production, i.e., the part that appears between {: :} blank. For debugging purposes, you could also put print statements that print out the names (and values) associated with the productions. This makes it easier to trace any potential errors. Be VERY careful when you transcribe the grammar; the slightest mistake can cause many hundreds of shift/reduce and reduce/reduce conflicts. I suggest you do it in an iterative fashion, slowly adding more and more information to the file. Do not type in the grammar by hand-copy it from the web page and then 'fix it up'. This will save you a lot of time and headaches caused by mistyping. Also be careful about semicolons; (!) all CUP productions are terminated by a semicolon. The grammar contains ';' as a terminal symbol, but in CUP that would be represented by the terminal SEMICOLON (this is what the semicolon is called by Flex. If you miss these SEMICOLON terminals you will get a lot of shift/reduce and reduce/reduce conflicts, so look for these as the first thing you do if you have such error messages.

  • Compile the compiler using the ant command.
  • Run the 'espressoc' script to test your compiler.
  • Compare to my reference implementation.

You too might be the next topper of your class; all you have to do is to get in touch with our professional Compiler Construction Assignment Help tutors today. We ensure you that we will never let you down.

Tags: Compiler Construction Assignment Help, Compiler Construction Homework Help, Compiler Construction Coursework, Compiler Construction Solved Assignments

Attachment:- Compiler Construction_2.rar

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Compile the compiler using the ant command
Reference No:- TGS03043899

Expected delivery within 24 Hours