Finish up parser and assembler with more-or-less complete syntax

Major changes inlude:

* Bit the bullet and now instructions have their length hard-coded
* Move from_utf8 object parsing to be done by their objects (instead of
  a Parser god object)
* A list of AST sections are assembled into an Object using the new
  vm::obj::assemble module.
* Changed the object layout some in the spec, and adjusted code to match
  this.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-09 13:04:56 -05:00
parent 329e61e087
commit e198da5825
19 changed files with 739 additions and 311 deletions

View File

@@ -1,28 +1,35 @@
.section data
data $0x1000 .. $0x2000 {
}
.section code
code $0x0 {
main:
storeimm %r00, $0xDEAD
storeimm %r01, $16
main:
storeimm %r00, $0xDEAD
storeimm %r01, $16
shl %r00, %r01
shl %r00, %r01
storeimm %r01, $0xBEEF
or %r00, %r01
storeimm %r01, $0xBEEF
or %r00, %r01
storeimm %r01, $0xDEADBEEF
storeimm %r01, $0xDEADBEEF
storeimm %r00, failure
storeimm %r01, ok
cmpeq %r00, %r01
storeimm %r00, failure
storeimm %r01, ok
cmpeq %r00, %r01
jz %r00
jz %r00
jmp %r01
jmp %r01
failure:
storeimm %status, $1
halt
failure:
storeimm %status, $1
halt
ok:
ok:
.export main
}
meta {
entry: main
}