Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
It appears that the language uses "return" as a synonym for the SYSCALL x86_64 instruction: https://github.com/wellang/well/blob/main/src/syscall_interp...
The example code is equivalent to:
write(1, "hello world!", 12);
Maybe an IR language would be some kind of less worse compromise for portability and to avoid complex syntax (C is already too rich and flexible). For instance like QBE (http://c9x.me/compile). There is llvm, but its grotesque and absurd c++ complexity does exclude it, de-facto.
The main pitfall with IR (like QBE), is intrinsics, because QBE does a bit of optimization and writting "hardware accelerated" intrinsics in a portable way forces the IR to generalize some instruction properties which "could" make even its simple optimization passes a nightmare.
You might find something interesting if you were to look at virtual-machines - many are used for implementing scripting-languages, so while you'd not be writing assembly-code, you'd be writing "bytecode" programs.
You could write bytecode for Lua, or bytecode for Python for example.
I had a fun few weeks writing a simple virtual-machine, and a "compiler" which turns a simple assembly-language-like input into bytecodes which are then interpreted:
https://github.com/skx/go.vm/
Other examples, along with lua/python which were already mentioned, might include "Writing a compiler in go" this turns a scripting-language into a set of opcodes which a VM executes:
* https://compilerbook.com/