This is the home of the GhostScript language!
npm install @beanthealien/ghostscript
npm install @beanthealien/ghostscript
`
Usage
Running A Script
VS Code\
Navigate to your script.\
Click Run > Run and Debug (select GhostScript as your running option if prompted).\
GhostScript IDE\
Navigate to your script.\
Click Run or the green arrow.
Making A Hello World
For a full guide to development with GhostScript, see Ghost For Dummies\
Start by making a new file with the .gst file extension.\
Open the file in your favorite editor.\
Start by writing this line into the script:\
import ghost;\
This will import the GhostScript standard library into the script's modules.\
Next, we will decide if we want to use an entry function (main) or not.\
This line is important to printing "Hello, World!", regardless of using an entry function or not:\
console.writeline("Hello, World!");\
This calls the console object (the terminal output window) and uses its method writeline.\
The writeline method writes a string to the console, ending with a newline.\
If you run your script, you should see "Hello, World!" in the output.\
With an entry function, we use the function declaration with the name main.\
The syntax for declaring our entry function is:\
function main()\
But, we aren't done yet.\
We need to add curly braces to define the scope of the entry function.
`
function main() {
}
`
In order to get our function to do anything, we need to write content inside the curly braces.\
Put the console writeline as shown earlier inside:
`
function main() {
console.writeline("Hello, World!");
}
`
Try running your script - you should see "Hello, World!".
Documentation
GhostScript docs
Command Prompt Commands
The following all work when using commands: ghostscript, ghost, gst, gs.\
init - Creates a new GhostScript project at the current directory.\
install - Installs a GhostScript module onto your system.\
run - Executes a GhostScript file.\
snapshot - Creates a new text file with the contents of the file path provided with the filename and ISO string as the name.\
upd - Updates the GhostScript package.\
version - Prints out the version of the installed GhostScript package.\
wiz - Runs the install wizard.\
rebuild - Removes all GhostScript files and re-installs.
Changelog
0.0.3
- Added new upd command. (runs npm update ghostscript)
- Major change to stdlib, you can find the full Ghost module at https://github.com/BeanTheAlien/BeanTheAlien.github.io/tree/main/ghost/modules/ghost
0.0.4
- Updated the stdlib to fix an error where it referenced undeclared types.
- Updated src/main to fix a lot of errors.
0.0.5
- Updated src/main to add method support and fixed errors.
- Updated src/main to work on the parser to support funcs. Started working on method support.
0.0.6
- Got src/main finally working. Supports very primitive scripts.
0.0.7
- Added variable support (define with var).
- Fixed an error in the stdlib that would cause undefined to not print.
- Fixed an error in the stdlib that would cause null and undefined to not be different values.
0.0.8
- Fixed the remote loader. Started implementing better import logic.
- Added in ide path. Work in progress IDE.
- Added more commands. (wiz, rebuild)
0.0.9
- Added array support.
- Updated block parsing. Supports primitive parsing using '{' and '}'. (22/11/2025)
- Began adding function support. (29/11/2025)
- Continued development to add function support. (30/11/2025)
- Added function support. (30/11/2025)
- MAJOR: updated variable logic to properly print undefined, should a variable not exist, instead of printing the name. (01/12/2025)
- Implemented array access. You can retrieve multiple elements by seperating indexes to be retrieved by a comma. (02/12/2025)
- Major updates to fix array indexing. (02/12/2025)
0.0.10
- This new version of GS includes support for basic functions, array indexing and variable setting! (02/12/2025)
- If statements now work with comparison (with '=='). (03/12/2025)
- Extender operator support and updated some structural things. (03/12/2025)
- More if statement support. Supports validity check and not valid checks. (03/12/2025)
- Fixed an error that caused \, !\ to not work. (04/12/2025)
- Added true, false, null, undefined as variables. (04/12/2025)
- Started implementing a better import system. (04/12/2025)
- Implemented logical operator handling. (04/12/2025)
- Implemented better import system. (04/12/2025)
- MAJOR: overhaul to better import system, fixed errors with better import system. (06/12/205)
- The params update is here! You can... delcare params! Also, funcs now respect the global scope. (07/12/2025)
- Decreased infinite loop detection count to 1M. (07/12/2025)
- Started implementing method support. (07/12/2025)
- Added target to keywords. (08/12/2025)
- Added parseCond to hopefully resolve conditional parsing outside of conditional headers. (10/12/2025)
- Made import non-greedy. (10/12/205)
- Added @huggingface/transforms to start implementing Auto Debugger API. (11/12/2025)
- Updated number matching to allow for a negative to proceed it. (12/12/2025)
- Updated array access to use Array.prototype.at to support negative indexing of arrays. (12/12/2025)
- Updated import system to check for a local file. To ensure local file import, use a string as the name of the import. (12/12/2025)
- The Auto Debugger API will be be paused until further notice. I apologize greatly and I hope to implement a solution as soon as possible. (14/12/2025)
- Fixed an error that caused target to be unexpected. (14/12/2025)
- Fixed an error that caused module failure to not be reachable. (14/12/2025)
- Fixed an error that caused everything to be evaluated as a method declaration. (14/12/205)
- Implemented ln/col, target error to be fixed. (15/12/2025)
- Target changed to return identifier, temporary fix to solve invalid context issue. (#9) (15/12/2025)
- Added config reading. Updated infinite_buffering` breaking in infinite loops accordingly. (15/12/2025)