Skip to content

Commit

Permalink
Update design.md
Browse files Browse the repository at this point in the history
Add section about assembler
  • Loading branch information
maximecb authored Oct 23, 2023
1 parent d7f4434 commit 4fefa12
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions doc/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,29 @@ behind various architectural choices.
UVM is a bytecode VM with a [stack-based](https://en.wikipedia.org/wiki/Stack_machine) interpreter,
which will eventually integrate a JIT compiler as well.
It uses a Harvard architecture where the stack, code and data (the heap) are effectively 3 separate address
spaces. The following sections go in to details to motivate these design choices and explain more about the
architecture of UVM. You can find a list of supported bytecode instructions in [vm/src/vm.rs](/vm/src/vm.rs).
spaces. The following sections go in to details to explain more about the
architecture of UVM and motivate these design choices. You can find a list of supported bytecode
instructions in [vm/src/vm.rs](/vm/src/vm.rs).

Do note that the design of UVM is evolving and some architectural choices are not yet finalized. Changes
will likely be made at various points to make the design more robust and also more flexible. Notably, the
strategies to be used to support parallel computations are still completely open for discussion. Your
feedback and ideas are welcome. We just ask that criticism be friendly and constructive.

### Assembler

UVM programs are contained in `.asm` files which are parsed by the UVM [assembler](/vm/src/asm.rs).
These files can be written by hand, or generated by a compiler.
The syntax is inspired by yasm/nasm and designed to be easy to read, and you can find some simple
examples under [vm/examples](/vm/examples). This repo also contains a toy C compiler (ncc) that emits
UVM asm files as its output.

There is a plan for UVM to eventually support a binary image format to store programs as well, but
at the moment, a textual format is easier to develop and refactor. This format is easy to target, and
the parser is likely able to parse hundreds of megabytes of input per second, so performance is
not much of a concern. The plan is to keep supporting the textual asm input format even when a binary
image format becomes available.

## Design Goals

UVM is designed with the following goals in mind.
Expand Down

0 comments on commit 4fefa12

Please sign in to comment.