EZC
is an RPN (Reverse Polish Notation), stack-based language which emphasizes terseness, compactness, and innovative problem solving techniques.
For example, Euclid's GCD Algorithm is: {:0== {`} {<>_% gcd!} ifel!} gcd funcdef!
Every function just operates on the stack, which is both dangerous, and useful at times. See more in the examples folder.
The code to print the square of a number is: N 2^print!
, i.e. 5 2^print!
prints 25
to the screen
More complicated expressions as well, like 2 3 4*+ print!
results in 14
To run an expression, run ec -e 'EXPR'
, i.e. like ec -e '5 2^print!'
To build ezc
, just clone this repo, or download a release.
Then, cd ezc
, or into the folder you downloaded it into.
First, run cp ezc-config.h.template ezc-config.h
, now modify ezc-config.h
. The comments in that file should help you determine what options you should build with. I would recommend building with readline
at the very minimum
Then make
. This should build the ec
binary in the ec/
directory.
This can be executed like: ./ec/ec -h
for help, or run it with an expression like ./ec/ec -e '2 3+ print!'
, to test it out. That example should print out 5
.
To install, run sudo make install
. By default, this installs to /usr/local
, so you can now run /usr/local/bin/ec
, or, provided your PATH
variable is sane, just run ec
in your shell.
You can install the extension for vscode, by visiting: https://marketplace.visualstudio.com/items?itemName=chemdev.ezc.