When I started osdev I set myself the challenge that all executable code of at least my kernel had to be generated using only NASM and any self-written tools. So, I've been working off-and-on on my own 'programming language' (although it's closer to an advanced pre-processing language for assembly than it is to an actual new programming language). It's essentially 'high-level' assembly including variables, control flow statements, functions, and recently structs and (non-static) methods. A true freak of nature.
The following image is of some test code running (demonstrating structs, methods and for-loops):
Attachment:
test kernel compressed.jpeg [ 102.05 KiB | Viewed 10485 times ]
The code used to generate the above image:
Code:
Graphics.Rectangle [myRectangle] = Graphics.Rectangle.NewRectangle(100, 150, 200, 250) # allocate & initialise a Rectangle struct
# fluctuate background color between orange and pink, and call myRectangle's Draw() method
colorLoop:
forbe(byte [green] = 0; cmp [green], 127; inc [green]) # the 'be' in 'forbe' indicates that the for-loop should continue as long as the below/equals condition is met, analogous to the letters 'be' in the 'jbe' instruction
{
mov al, 127
sub al, [green]
Graphics.fillScreen([buffer], 255, [green], al)
[myRectangle].Draw([buffer])
Graphics.copySSE([buffer], [Graphics.framebuffer], [Graphics.frameSize])
}
forbe(byte [blue] = 0; cmp [blue], 127; inc [blue])
{
mov al, 127
sub al, [blue]
Graphics.fillScreen([buffer], 255, al, [blue])
[myRectangle].Draw([buffer])
Graphics.copySSE([buffer], [Graphics.framebuffer], [Graphics.frameSize])
}
jmp colorLoop
I'm parsing this using a Python library called
Arppeggio, and the parse-tree is then compiled/transpiled into assembly code by a compiler (or whatever I should call it) I wrote from scratch in C#, after which the result is assembled using NASM.