A5
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
This directory contains the following files: - allheaders.h.gch which is a pre-compiled header file. - libsclpshared.so which is a shared object file. - sclp which is the reference implementation. - program-eval.cc, procedure-eval.cc to get the flow of interpreter eval option, use of Symbol Table create function with local environment. - reg-alloc.cc for regsiter allocation scheme - Makefile which contains the commands to build your implementation. - Besides, the following header files are provided ONLY for telling you the class structure and the member functions whose implementation is provided in the library. YOU DO NOT NEED TO INCLUDE ANY OF THESE FILES IN YOUR IMPLEMENTATION. . storetokens.hh contains the declaration of the function which you can call to store tokens and print them. . ast.hh . procedure.hh . program.hh . symbol-table.hh . local-environment.hh . reg-alloc.hh . icode.hh You need to write - a scanner, - a parser, - actions within the scanner and parser to construct Abstract Syntax Trees, - ast functions, and - an interperter - a compiler which generates spim code for the input program. A high level description of the classes can be found on the sclp web page https://www.cse.iitb.ac.in/~uday/web-source/. You need to create the top level object for program. You should work in the following steps: 1. Enhance your implementation of A4 by adding new rules in the scanner and parser for print operator (syntax: print var) 2. Add code to construct the ASTs for the new constructs. 3. Add code to generate spim code from ASTs. This involves a. creating Code_For_Ast (see icode.hh file), b. printing the icode using the function print_icode(...), and c. printing the assembly code using the function print_assembly(...). File reg-alloc.cc contains the descripton of the data structure holding the machine details. The compiled version of this file has been included in the library, so you do not have to include it in your submission. For ease of working on small programs, you can use the -d option to produce the dump on the screen instead of having to open the dump files. For the AST you need to create objects of the following classes: - Assignment_Ast, - Name_Ast, - Number_Ast, - Arithmetic_Expr_Ast (and its derived classes) - Selection_Statement_Ast - Relational_Expr_Ast - Logical_Expr_Ast - COnditional_Op_Ast - Iterative_Statement_Ast - Sequence_Statement_Ast - Print_Ast You will need to submit ONLY the scanner.l, parser.y, ast.cc, local-environment.cc, ast-eval.cc, ast-compile.cc, and icode.cc files. The code for symbol table and register allocator has been given to you in the library. The compiled version of this file has been included in the library, and you should not include it in your submission.