Calcit Scripting Language
Lisp compiling to JavaScript ES Modules. Runs in Rust(Similar to ClojureScript, but in very different syntax.).
- Home http://calcit-lang.org/
- API Doc(heavily influenced by ClojureScript) http://apis.calcit-lang.org/
- Dev Logs https://github.com/calcit-lang/calcit_runner.rs/discussions
- 视频记录 https://space.bilibili.com/14227306/channel/seriesdetail?sid=281171
Browse examples or also try WASM version online.
Install
Build and install with Rust:
# get Rust
|
# get Calcit
For Ubuntu 20.04, try binaries from http://bin.calcit-lang.org/linux/ , which are provided for CI usages.
Usage
Snippets evaling:
# multi-lines snippet
Run with a compact.cirru:
Emitting code:
Calcit Editor & Bundler
Install Calcit Editor and run ct
to launch editor server,
which writes compact.cirru
and .compact-inc.cirru
on saving. Try launching example by cloning Calcit Workflow.
Read more in Minimal Calcit to learn how to code Calcit with a plain text editor.
Read more in Respo Calcit Workflow to learn to create an MVC webpage with Respo.
Modules
No package manager yet, need to manage modules with git tags.
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
.
Web Frameworks:
- Respo - tiny Virtual DOM library
- Phlox - wraps PIXI.js in Virtual DOM style
- Quamolit - wraps Three.js in Virtual DOM style
- Quatrefoil - Canvas API in virtual DOM style, with ticking rendering
Mini libraries:
- Lilac, data validation tool
- Memof, caching tool
- Recollect, diffing tool
- Calcit Test, testing tool
- Bisection Key, ...
- Lilac Parser, string parsing tool
Extensions
Rust supports extending with dynamic libraries, found an example in dylib-workflow. Currently there are some early extensions:
- Std - some collections of util functions
- WebSocket server binding
- HTTP client binding
- HTTP server binding
- Wasmtime binding
- Canvas demo
Development
I use these commands to run local examples:
# run tests in Rust
# run tests in Node.js
&&
# run snippet
- Cirru Parser for indentation-based syntax parsing.
- Cirru EDN for
compact.cirru
file parsing. - Ternary Tree for immutable list data structure.
Other tools:
- Error Viewer for displaying
.calcit-error.cirru
- IR Viewer for rendering
program-ir.cirru
License
MIT