Commit Graph

5 Commits

Author SHA1 Message Date
fcef6c053d Update calling convention
Previously, the stack would look like this when calling a function:

TOP
| arg2     |
| arg1     |
| function |
BOTTOM

This order is now reversed, with the function coming first and then the
args:

TOP
| function |
| arg2     |
| arg1     |
BOTTOM

This is a little more friendly to the stack-based machine. It is
slightly less intuitive as far as order of operations goes, but having a
function's arguments depend on the state of the function itself is a
little suspect and easy to work around if you truly need that.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-04-07 00:36:16 -07:00
4cec6f0765 Squash minor warning in vm/mod.rs
Inst::Comment is no longer printing, so we don't need the "comment"
variable to be usable.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-04-07 00:27:28 -07:00
7bac4306c3 Add base branch logic
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-04-07 00:00:04 -07:00
4d005494a3 assignment: Add variable assignment
* Syntax for x = y
* Compiler creates Inst::Store thunks
* New Vm::store function

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-04-02 01:55:51 -07:00
bfe7ca33bd Initial commit
* Parser, compiler, objects, and VM base implementations
* Stuff will print out, functions called, etc
* There are probably plenty of bugs but this is a good starting point to
  start committing changes into git

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2023-04-01 22:34:35 -07:00