This is an esolang that transpiles to JavaScript. The language has its name because no variables, functions or file names are allowed to use vowels, inspired from leetspeak. Everything else in the language has basically nothing to do with gaming and is instead just random things my friends and I thought of to be annoying to use.
The file extension for g4m3rscr1pt files is .p0g
. Every g4m3rscr1pt program will loop forever with a 0.1 second delay between each repetition so to terminate a program you must throw an exception. The examples
folder of this repo has some example g4m3rscr1pt programs.
You will need node and npm.
npm install -g g4m3rscr1pt
I also recommend getting the g4m3rscr1pt VSCode extension for syntax highlighting.
- Create a file that ends with
.p0g
(make sure there's no vowels in the name). - Code in the file.
- Transpile using
les gooo f1le.p0g output.js
.- If no output file is specified, the code will just be immediately executed instead.
Numbers in g4m3rscr1pt are base 5 and are represented with the vowels (a
is 0, e
is 1, i
is 2, o
is 3, u
is 4). For example, eo
is 8 and uio
is 113.
Note: when numbers are printed, they are displayed normally.
You use ]
to open a string and [
to close it. For example ]this is a string[
. Only single line strings exist.
Variables can be any combination of consonants and numbers. For example v
, l3tt3r
, mNb
and 9
are all valid variables. To assign a value to a variable, you write the name, then a colon and then the value like this:
n4m3: ]Joe[
d0ll4rs: oi
Using an @ makes the rest of the line a comment. There are no multi-line comments.
@this is valid comment
tw0: i @ so is this
@ tw0: e
/R33333{tw0} @prints 2
Functions in g4m3rscr1pt are called commands.
To define a command first write the name of the command, then moment
. If it has any parameters, then write a pair of curly brackets and write the parameters within them, separated by a space. Don't include any curly brackets if there's no parameters. ??!?1!
is then used to start the definition and !?!!??
to end it. Within those is where you write the code for the command. To return a value, write https://imgur.com/jWr67J8
followed by the value. Here's an example:
@ addition command
4dd moment {x y} ??!?1!
n1: /M1n7S{a e} @ negative 1
ny: /D1V1D3{y n1} @ negative y
https://imgur.com/jWr67J8 /M1n7S{x ny}
!?!!??
To execute a command, type a /
and then the name of the command. If there's any arguments, add a pair of curly brackets and separate each argument within them with a space. Example:
@ use the add command defined above
/R33333{/4dd{i o}} @ prints 5
/BR4P @ throws an error
Using multiple /
is called a super command. The value returned by the command is put back in as the first argument as many times as there are /
. 99_b0ttl3s_2.p0g
in the examples
folder utilises this.
x: /////M1n7S{ia e}
/R33333{x} @ prints 5
These commands are predefined in every g4m3rscr1pt program. Any commands that use maths will throw an error if rounding the result is not a safe integer (according to JavaScript). Also note that since g4m3rscr1pt transpiles to JavaScript, it has type coercion. For example:
/M1n7S{ea u} @ 1
/M1n7S{]5[ u} @ 1
Prints output
to the console. Returns what is printed.
Prints prompt
to the console and returns the user's input.
Returns x
minus y
.
Returns x
divided by y
.
Returns x
to the y
th root.
Pauses everything for seconds
.
Returns text
but red.
Returns text
but green.
Returns string1
concatonated with string2
.
Returns number
as a string, represented using vowels.
/R33333{ea} @ prints 5
/R33333{/str1ng1fy{ea}} @ prints EA
Returns the unicode number of the first character of string
.
Returns the character of string
at index
.
Returns a string of the content in the file at path
.
Throws an error.
The equivalent of a try/catch is a yeahnah. Everything in the yeah
block is run until there's an exception, in which case everything in the nah block is run. For example:
yeah ??!?1!
/R33333{]this is printed first[}
/D1V1D3{e a} @this throws an error since you can't divide by 0
/R33333{]this is never printed[}
!?!!?? nah ??!?1!
/R33333{]this is printed second[}
!?!!??
If you just suck too much to completely use g4m3rscr1pt (or there's something you actually can't do) you can enter plain JavaScript like this:
I'M CHEATING <
// Note: hello can't be used outside of JS since it has vowels
const hello = "Hello, World!";
console.log(hello);
> I'M NOT CHEATING ANYMORE
I had a lot of help from this playlist by Toby Ho and I was inspired to create an esolang from Truttle1.