21 releases

new 0.3.11 May 7, 2021
0.3.9 May 5, 2021
0.3.0 Apr 30, 2021

#86 in Emulators

Download history 134/week @ 2021-04-23 147/week @ 2021-04-30

93 downloads per month

MIT license


Calcit Runner

An interpreter 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!)
    :modules $ []
  :files $ {}
    |app.main $ {}
      :ns $ quote
        ns app.main $ :require
      :defs $ {}
        |main! $ quote
          defn main! () (+ 1 2)
        |reload! $ quote
          defn reload! ()

APIs implemented in Calcit Runner is mostly learning from Clojure. Major difference arguments order of list functions.



cargo run calcit/compact.cirru

# evaluate

calcit_runner compact.cirru --once # run only once
calcit_runner compact.cirru # watch mode enabled by default

calcit_runner compact.cirru --init-fn='app.main/main!' # specifying init-fn

calcit_runner -e="range 100" # eval from CLI

# emit code

calcit_runner compact.cirru --emit-js # compile to js
calcit_runner compact.cirru --emit-js --emit-path=out/ # compile to js and save in `out/`

calcit_runner compact.cirru --emit-js --mjs # TODO compile to mjs
calcit_runner compact.cirru --emit-ir # TODO compile to intermediate representation

For linux users, download pre-built binaries from http://bin.calcit-lang.org/linux/ .



: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.

Older version

This interpreter was first implemented in Nim and then switch to Rust. Main change is the order of arguments where operands are now placed at first.




~139K SLoC