Skip to content

bob-laz/PascalCompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DESCRIPTION

This project is a Mini-Pascal to MIPS assembly compiler. It is written in Java. The program parses an input pascal file utilizing its own custom scanner, which was generated using JFlex. The parser generates a symbol table and syntax tree for the pascal program. The syntax tree generated has code folding performed on it and is then traversed to generate the assembly code. The MIPS assembly can be run using the QtSpim simulator.

The program can be run from the command line using the compiled .jar file located in the product folder. Sample mini-pascal files can be found in src/pascalfiles. Use the following command while in the same directory as the .jar:

java -jar compiler.jar money.pas

Note: make sure your .pas file is in the same directory as well or include the path to it.

A .asm file with the same name as your mini-pascal file will then be generated in the same folder. Load that file into QtSpim and run.

About

This program compiles a modified version of Pascal into MIPS assembly

Resources

Stars

Watchers

Forks

Packages

No packages published