Beware! Despite the serious look (hopefully!), Ven is just a hobby project I work on from time to time.
This repository contains a reference interpreter for the Ven programming language. Ven is lightweight, slick and elegant; it is inspired mostly by Perl (and Raku), JavaScript, Python and Lisp (yes, Lisp!)
- Clone this repo.
With Docker:
A Docker buildimage is shipped with Ven.
- Run
docker build -t venlang .
; - Run
docker run --rm -v $(pwd)/bin:/build/bin venlang
; - The executable will be in
bin/
. If you ran Docker as root, you might want tochown
the executable:sudo chown <your-user> bin/ven
.
Without Docker:
- Run
shards install --ignore-crystal-version
; - Run
shards build --release --no-debug --production
.
Also, make sure to install Inquirer.
Otherwise, distinct
and expose
statements won't work.
You can strip
the executable to reduce its size (goes down to about 5M).
Note that:
- Ven is not ready enough for experimental use.
- Ven is never going to be ready for production.
First, you have to start Inquirer:
/path/to/bin/inquirer start -d
starts Inquirer in detached mode, i.e., as a daemon that will run in the background; Omit the-d
flag if you want to see what the server is doing, live.- You can see what Inquirer is up to by the means of its
interactive shell (
/path/to/bin/inquirer shell
), too. Typeping
into the prompt, and you'll hopefully seepong
; - You can quit from the Inquirer shell by pressing CTRL+D;
- It is not recommended to leave Inquirer running in background
for too long (who knows what leaks there may be!). To
stop Inquirer, you can run
/path/to/bin/inquirer stop
, or use thedie
command from the interactive shell.
Second, try to run Ven:
- Run
/path/to/bin/ven sanity -t
. If it worked with no errors, you have successfully built Ven. Moreover, Ven itself had a proper interaction with the running instance of Inquirer! If there was a boom, though, make sure Inquirer's running and, if things still fall apart, file a bug here or in the Inquirer repository (choose as you wish). - If you want to play with Ven through an interactive prompt,
run
/path/to/bin/ven
. - If you want to see what's going on under the hood, pass
-j
(or--just
) flag (ven -j <...>
). It halts Ven at the specified stage of the interpretation process. Try-j read
,-j compile
and-j optimize
. If you don't know what to type, type1 + 1
🙂 - Use
/path/to/bin/ven path/to/file.ven
to run a file. Tryven examples/calculator.ven
. The-j
flag works here, too, andven -j optimize examples/calculator.ven
dumps on you the optimized bytecode — as expected.
- Fork it;
- Create your feature branch (git checkout -b my-new-feature);
- Commit your changes (git commit -am 'Add some feature');
- Push to the branch (git push origin my-new-feature);
- Create a new Pull Request.