Compiler design
Question Description
This project requires modification to the bison input file, so that it defines the additionalsemantic checks necessary to produce these errors and addition of functions to the library of typechecking functions already provided in types.cc. You must also make some modifications tothe functions provided. You need to add a check to the checkAssignment function formismatched types in the case that Boolean and numeric types are mixed. You need to also addcode to the checkArithmetic function to coerce integers to reals when the types are mixed andthe error message must be modified to indicate that numeric rather than only integer types arepermitted.The provided code includes a template class Symbols that defines the symbol table. It alreadyincludes a check for undeclared identifiers. You need to add a check for duplicate identifiers.Like the lexical and syntax errors, the compiler should display the semantic errors in thecompilation listing, after the line in which they occur. An example of compilation listing outputcontaining semantic errors is shown below:1 — Test of Multiple Semantic Errors23 function test a: integer returns integer;4 b: integer is5 if a + 5 then6 2;7 else8 5;9 endif;Semantic Error, If Expression Must Be Boolean10 c: real is 9.8 – 2 + 8;11 d: boolean is 7 = f;Semantic Error, Undeclared f12 begin13 case b is14 when 1 => 4.5 + c;15 when 2 => b;Semantic Error, Case Types Mismatch16 others => c;17 endcase;18 end;Lexical Errors 0Syntax Errors 0Semantic Errors 3You are to submit two files.1. The first is a .zip file that contains all the source code for the project. The .zip fileshould contain the flex input file, which should be a .l file, the bison file, which shouldbe a .y file, all .cc and .h files and a makefile that builds the project.2. The second is a Word document (PDF or RTF is also acceptable) that contains thedocumentation for the project, which should include the following:a. A discussion of how you approached the projectb. A test plan that includes test cases that you have created indicating what aspectsof the program each one is testing and a screen shot of your compiler run on thattest casec. A discussion of lessons learned from the project and any improvements that couldbe made
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."