Milho is a lisp-ish language created by @celsobonutti and me (@danfragoso).
This repo hosts the GO implementation of the Milho interpreter and compiler. There's also Rust, Haskell and OCaml implementations.
Tokenizer β Parser β MIR
β β Interpreter (Linux, BSD, WebAssembly)
β or anything you manage to run GO on.
β
β β Compiler/Codegen
β β JavaScript source code
β β LLVM IR code
make build
make install
milho hello.milho
If you want to run milho files from the command line, you can create a milho script.
You just need to add #!/bin/milho
to the top of your file and run with ./script.milho
.
#!/bin/milho
(defn getUserName ()
(exec-stdout "git" "config" "--get" "user.name"))
(defn buildHelloString (who)
(str "Hello " who "! π½"))
(def userName (getUserName))
(if (! (= userName ""))
(println (buildHelloString userName))
(exit 1)) ;; Exit with error if no user.name.
// To JavaScript
milho -cJS examples/hello.milho > hello.js
node hello.js
// To LLVM IR
milho -cLLVM examples/hello.milho > hello.ll
lli hello.ll
make hooks
make repl
Milho REPL π½ v.6f29e9e_2021-04-22
Danilo Fragoso <danilo.fragoso@gmail.com> - 2021
π½ > (def milho 10)
πΏ milho
π½ > (def sq_milho (* milho milho))
πΏ sq_milho
π½ > (prn sq_milho)
100
πΏ Nil