Pascal-mips-compiler is a project mainly written in C++ and C, it's free.
CSE440 compiler construction project - pascal to mips compiler
^__^
(oo)_______
(__) )/
||----w |
|| ||
Project Information
Building, running, and testing instructions
What cases are handled
What the parse tree looks like
Project Information
Authors:
Josh Wolfe
Andrew Kelley
Description:
Compiles a pascal-like language to MIPS assembly.
Comment policy:
Instead of comments everywhere, use descriptive variable names and
functions.
Building and running instructions
To compile the project, cd to the project directory and run:
make
You can run the program manually like this:
./opc tests/test_name.p > out.mips
To run the MIPS program, you must have spim (or some other MIPS interpreter):
to install spim in Ubuntu/Debian:
sudo apt-get install spim
to run the MIPS program:
spim -file out.mips
To run the test suite, you must have Python 2.6 or later and spim:
make test
What cases are handled
all the tests in tests/ that have a .p, a .p.errors, and a .p.out.
What the parse tree looks like
Program ClassList[] ClassDeclaration ClassBlock VariableDeclarationList[] VariableDeclaration IdentifierList[] TypeDenoter ArrayType FunctionDeclarationList[] FunctionDeclaration VariableDeclarationList[] FunctionBlock VariableDeclarationList[] StatementList[] Statement AssignmentStatement VariableAccess IndexedVariable VariableAccess ExpressionList[] Expression AdditiveExpression MultiplicativeExpression NegatableExpression[] PrimaryExpression VariableAccess FunctionDesignator ActualParameterList[] ActualParameter Expression Expression Expression MethodDesignator VariableAccess FunctionDesignator Expression PrimaryExpression MultiplicativeExpression AdditiveExpression AdditiveExpression AttributeDesignator Expression IfStatement Expression Statement Statement PrintStatement Expression WhileStatement Expression Statement StatementList[]