Statically typed functional programming language implementation with Go and LLVM
github.com
github.com
"GoCaml is subset of OCaml in Go based on MinCaml using LLVM. GoCaml adds many features to original MinCaml. MinCaml is a minimal subset of OCaml for educational purpose. It is statically-typed and compiled into a binary."
What do they mean with "GoCaml is subset of OCaml in Go"? Do they mean the compiler is written in Go?
https://esumii.github.io/min-caml/paper.pdf
I added it to our site for bootstrapping as it's a nice way to transition from a small, imperative 3GL into a ML. Well, without using a LISP or other metaprogramming tool that is. The bootstrapping site is here if you're interested in other small languages and builds:
As for why I chose Go, I wanted something which was pretty portable, with decent performance, easy to build command line tooling in, but at a slightly higher level of abstraction than C; that way I could conceivably port it to C or C++ relatively easily if I felt like that was a better way to go down the road, but could mostly focus on getting things done in the short term. I'm not a huge fan of the OCaml toolchain, even though I like the language, and it's not very approachable for other people if they wanted to pitch in. Go isn't an ideal language to build a compiler in, but it's not bad either. I'm comfortable with it though, and that's all that really matters for a project like this.
I've found SPJ's paper but I find it a bit of a grab-bag of ideas (difficult to see how to implement it step by step instead of all at once).
* Replace function application (function call) expression with body of inlined function
* Now replace all variables in the target function body with the argument values from the func expr
* Re-bind all variables.
(Some details elided :) )
The trickiest aspect of inlining is deciding what to inline.
Yes, checking what to inline is tricky, but I'm not there yet; my code is still very simple and everything can be inlined in principle (unless of course intermediate results would cause problems, which I'm not sure about).