assyrianic / Tagha

Minimal, low-level, fast, and self-contained register-based bytecode virtual machine/runtime environment.
MIT License
124 stars 8 forks source link

implement assembler #8

Closed assyrianic closed 6 years ago

assyrianic commented 7 years ago

Implement a very simple assembler. Notably, the way I'd like it work is like this...

    pushl 7 ; push 7 as 4 byte int
    pushl 4.0 ; floats but pushl pushes it as 4-byte int
    pushq 4.0 ; pushes 4.0 as an int64
    call myfunc ; labels for functions
    halt
myfunc:
    pushq 11
    pushbpsub
    loadspl
    pushl 1
    uleql
    jzl over ; labels for jump opcodes
over:
    ret