Generate Clojure syntax from vectors
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
polyfill/cirru_sepal
src/cirru_sepal
.gitattributes
.gitignore
README.md
build.boot
calcit.edn
package.json
shadow-cljs.edn
yarn.lock

README.md

Cirru Sepal for Clojure

Generate Clojure code from vectors(based on FIPP)

[ "defn" "f1" [ "x" ]
  [ "+" "x" "1" ] ]

compiles to:

(defn f1 [x] (+ x 1))

API Usage Clojars Project

[cirru/sepal "0.2.5"]
(cirru-sepal.core/write-code [["println" ["+" "2" "2"]]])

(cirru-sepal.analyze/write-file {:ns ["ns" "a.b"], :proc [], :defs {:main! ["defn" "main!" ["a" "b"]]}})

In file mode, code will be ordered in an order, with definitions sorted by dependencies. (declare some-function) would be generated if potential circular dependencies detected.

:ns
:defs
  def1
  def2
  ...
:proc

Special forms:

  • []
  • {}
  • #{}
  • ; and ;;
  • case
  • def
  • defn, defn$(with arity overloading)
  • defn-, defn$-(with arity overloading)
  • fn, fn$(with arity overloading)
  • fn*, #()
  • let
  • loop
  • ns
  • doseq

Special syntaxes:

  • |str and "str generates "str"
  • #"x generates #"x"

Find working examples in data/examples/ and data/compiled/.

Test

yarn test

Acknowledgements

License

MIT