This is a console application written in the Java programming language, implementing a PostScript interpreter with its most common and basic operations, categorized as:
- Stack
- Arithmetic
- Dictionary
- String
- Boolean
- Flow Control
- Input/Output
- Install the Java Runtime Environment
- Since this program is entirely written in Java, you'll need to have a version of JRE downloaded and installed to your machine if you don't already. You can find the necessary JRE at this link.
- Configure the Local Bash/Batch Files for Program Execution (optional)
- There are four different scripts at the root of the project directory, the configuration of these scripts provides the best user experience for this interpreter, but is not necessary.
- Files ending in
.bat
are for users of the Windows operating system, while files ending in.sh
are for users of Unix-like operating systems, such as Linux distributions or Macintosh. - Windows Configuration Guide:
- Via Windows File Explorer, navigate to the location in which you've chosen to store the project folder.
- Once there, you should see a file named
install_pj.bat
, right-click this file and then click 'Run as Administrator'. If you have a terminal window currently open, you will be prompted to restart it after this step. - Now open the Windows Search Bar, search for your favorite command-line interface (Powershell, Git Bash, CMD, etc.), and type and enter
pj
to invoke the interpreter. NOTE: I did not officially test this batch script, as I am running this program via Linux, I apologize for my laziness. Should it not work, Jump over to the traditional method.
- Unix/Linux Configuration Guide:
- Via your system terminal, navigate to the project's root directory via
cd path/to/project
. - Type and enter the following to ensure the bash scripts are executable:
chmod +x ps install_pj.sh
- Then, to configure the installation script, type and enter
sudo ./install_pj.sh
, and enter your password when prompted. - You can now enter
pj
from any directory in your terminal to invoke the interpretor.
- Via your system terminal, navigate to the project's root directory via
- If You Prefer the Traditional Method of Compiling and Running
- Windows:
- Compile:
javac -cp "/lib/*" test/*.java src/*.java main/*.java
- RunL
java -cp "lib/*;main;src;test" Main
- Compile:
- Unix/Linux:
- Compile:
javac -cp "lib/*" test/*.java src/*.java main/*.java
- Run:
java -cp "lib/*:main:src:test" Main
- Compile:
- Windows:
By default the interpreter uses dynamic scoping, and you as the user are made aware of what scope the interpreter is using via the prompt [PJ:D > 0]
, where the character 'D' designates the interpreter is using dynamic scoping. By entering the command lex
, the interpreter will switch over to lexical scope, and to switch back, simply enter the command dyn
.