AbduAlmenan / PascalCompilerInJava

Compiler for Simple Pascal in Java with SableCC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pascal Compiler in Java

Created a Compiler for Simple Pascal in Java with SableCC. Simple Pascal is a subset of the normal Pascal.

This Compiler takes a Pascal file and creates a *.class file for it, which can be executed using Java as usual.

Compiling a file and liveness analysis

  1. I attached a build.xml file to use sablecc automatically to use my specified grammar in Java. So just type in your shell:

> ant

or by hand:

> java -jar sablecc.jar sablecc.scc

  1. Compile all created classes

> javac *.java

  1. Start compiling with:

> java StupsCompiler -compile <Filename.pas>

  1. OR start a liveness analysis for all variables used in the Pascal file

> java StupsCompiler -liveness <Filename.pas>

  1. Create Bytecode with jasmin

> java -jar jasmin.jar <Filename.j>

  1. Execute compiled Pascal file

> java Filename

About

Compiler for Simple Pascal in Java with SableCC


Languages

Language:Java 47.5%Language:Jasmin 27.7%Language:Pascal 13.6%Language:Shell 7.3%Language:Python 3.9%