Calcit Runner
(Lisp but with indentations.) An interpreter for Calcit snapshot file.
This project provides a runner for compact.cirru
, written in Rust for low overhead.
APIs implemented in Calcit Runner is mostly learning from Clojure. Major difference arguments order of list functions.
Installation
For Ubuntu 20.04 users, binaries are available from http://bin.calcit-lang.org/linux/ . It was mainly provided for CI usages.
For other platforms, I'm afraid you have to build from source in Rust with cargo install --path=./
.
Calcit snapshot & Bundler
Running Calcit Editor with compact=true caclcit-editor
enables compact mode,
which writes compact.cirru
and .compact-inc.cirru
instead of Clojure(Script).
A compact.cirru
file may look like:
{} (: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! ()
But, you probably don't like it. You only to edit code with a simple text editor. So.... there's also command for bundling compact.cirru
from separated files:
package.cirru
should contain fields:
{}
:package |app
:modules $ []
:init-fn |app.main/main!
:reload-fn |app.main/reload!
:version |0.0.1
and files in src/
are source files of namespace form and definitions. By running:
a bundled compact.cirru
file will be created.
Usage
Run:
# evaluate
# emit code
Modules
Configurations inside calcit.cirru
and compact.cirru
:
:configs $ {}
:modules $ [] |memof/compact.cirru |lilac/
Paths defined in :modules
field are just loaded as files from ~/.config/calcit/modules/
,
i.e. ~/.config/calcit/modules/memof/compact.cirru
.
Modules that ends with /
s are automatically suffixed compact.cirru
since it's the default filename.
To load modules in CI environments, make use of git clone
.
Development
I use these commands to run local examples:
- Cirru Parser for indentation-based syntax parsing.
- Cirru EDN for
compact.cirru
file parsing.
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.
License
MIT