New Assembly Like Programming Language?
github.com
github.com
Wow, I wonder if Jim Neil really is still selling it (it looks like he is). I wonder if it still comes on an 1.44MB diskette (http://terse.com/neildeal.htm#whatget) :-D
I never used it, nor saw it in use by anyone else. I just remember coming across it multiple times when looking at PC assembly language books and tools.
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:
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:
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.
That said, I would go RISC-V assembly (64bits) with a conservative usage of a pre-processor.
You might think that the preprocessor is "weak", which it is, but, look, I used it to define a loop language for Awk, with not only a variety of standard clauses but an easy way to write new clauses.
You can loop over strings, associative arrays, ranges, find maxima, minima, argmax, count, collect lists (there is a Lisp-like layer defining cons cells) and such.
https://www.kylheku.com/cgit/cppawk/about/
(See the info about <iter.h>. There is a man page covering the loop macro and the test suite has coverage of all its clauses in testcases-iter).
Such Macro-Assemblers are also quite common on the mainframe world, besides the 16 bit home micros.
In any case, nasm and yasm do exist as FOSS version of such ideas.
[also] The makefile calls on src/printf.hpp, which is missing.
The example code is equivalent to:
write(1, "hello world!", 12);
exit(0);
It's basically just doing some very simple string substitution on the input, and then piping the result to the nasm assembler.It also had a structured way to define variables and new opcodes (subroutines). It actually seemed to be a productive language that allowed you to transition from low-level to high-level programming pretty well. It didn't insulate you from needing to know details of the CPU, but that's really necessary for any sort of performant computing.
I stopped working on it when I released I was basically reinventing Forth.