4 ms·
Another commenter already mentioned Gambit Scheme. That provides for inline C and therefore very easy interop with external libraries. It still has a runtime an
by d110af5ccf 5y ago
Another commenter already mentioned Gambit Scheme. That provides for inline C and therefore very easy interop with external libraries. It still has a runtime and GC though - those might pose a problem depending on your platform and task.
Ferret (https://github.com/nakkaya/ferret https://github.com/nakkaya/ferret) and Carp (https://github.com/carp-lang/Carp https://github.com/carp-lang/Carp) are both Lisp-like low level languages. Both seem to be fairly experimental in nature though.
> anything but C
Taking you literally, Rust and D can both compile for bare metal. D in particular has a "Better C" subset. (https://dlang.org/spec/betterc.html https://dlang.org/spec/betterc.html)
In the same vein, Terra is a C like language (manual memory management) that you metaprogram with Lua. (https://github.com/terralang/terra https://github.com/terralang/terra)
Taking you very literally, Forth is also an option.
- elcritch 5y agoI went down many of those routes myself, though not the lisp ones. There's also TCL. But I've settled on Nim as my favorite for embedded (at least for a while). For the esp2866 Rust (or D) would be tricky. Nim can compile to C, unlike Rust which doesn't support the Xtensa architecture found on most esp chips. Not sure about D bit it seems unlikely to support Xtensa. There's a Nim Esp2866 sdk: https://github.com/clj/nim-esp8266-sdk https://github.com/clj/nim-esp8266-sdk And a youtube talk on Programming esp2866: https://youtu.be/eCCrkZI0rVU https://youtu.be/eCCrkZI0rVU Just be sure to use ARC/ORC. If you're interested in esp32's as well, I wrote a Nim wrapper of the esp-idf: https://github.com/elcritch/nesper https://github.com/elcritch/nesper
- d110af5ccf 5y agoJust to clarify - Gambit, Chicken, and Carp all compile to portable C. I hadn't realized LLVM mainline doesn't support Xtensa. I'm surprised. D does support Xtensa via LDC (https://forum.dlang.org/thread/rpdwiusbevvphqyvjhdj@forum.dlang.org https://forum.dlang.org/thread/rpdwiusbevvphqyvjhdj@forum.dl...). It looks like GDC also nearly supports it, requiring only a minor patch at present. A functioning LLVM backend does exist (https://github.com/espressif/llvm-project/issues/4 https://github.com/espressif/llvm-project/issues/4) and appears to be making very slow progress towards being merged. A quick search shows that it works for Rust. I suspect (but don't know) that it might work for Terra as well. There's also the LLVM C backend (https://github.com/JuliaComputingOSS/llvm-cbe https://github.com/JuliaComputingOSS/llvm-cbe) but I've no idea how efficient such an approach is when applied to real world embedded tasks.