Calcit Runner
An interpreter runtime for Calcit snapshot file.
Running Calcit Editor with compact=true caclcit-editor
enables compact mode,
which writes compact.cirru
and .compact-inc.cirru
instead of Clojure(Script).
And this project provides a runner for compact.cirru
, written on Nim for low overhead.
A compact.cirru
file can be:
{} (:package |app)
:configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!)
:files $ {}
|app.main $ {}
:ns $ quote
ns app.main $ :require
:defs $ {}
|main! $ quote
defn main! () (+ 1 2)
|reload! $ quote
defn reload! ()
:proc $ quote ()
APIs implemented in Calcit Runner is mostly learning from Clojure.
Usage
Install dependency:
brew install fswatch sdl2 cairo
nimble test --threads:on -y
Build binaries:
nimble build --threads:on
There are currently 2 commands cr
and cr_once
:
cr compact.cirru
cr compact.cirru --once
cr compact.cirru --init-fn='app.main/main!'
cr -e="range 100"
cr --emit-js
cr --emit-ir
cr_once
For linux users, download pre-built binaries from http://bin.calcit-lang.org/linux/ .
Development
Dependent modules, besides SDL2 and Cairo:
Alias in dev mode:
nimble watch
nimble once
nimble e
nimble genjs
nimble genir
Modules
:configs $ {}
:modules $ [] |phlox/compact.cirru
Calcit Runner use ~/.config/calcit/modules/
as modules directory.
Paths defined in :modules
field are just loaded as files based on this directory,
which is: ~/.config/calcit/modules/phlox.caclit.nim/compact.cirru
.
To load modules in CI environment, create that folder and clone repos manually.
License
MIT