aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-08-24 23:31:14 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commitd9f652919961a2947452ad3c4af4659f3d2fb330 (patch)
tree2db541db311a9b5a83d3f2c9b199f6d5c3341555 /doc
parent40652d7dbf701eda83fa8323b42a6b5bf0ca6bdd (diff)
Add if/else/elseif/while, including the final assembly
Diffstat (limited to 'doc')
-rw-r--r--doc/Documentation.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/Documentation.md b/doc/Documentation.md
index 8b2133e..adb0bef 100644
--- a/doc/Documentation.md
+++ b/doc/Documentation.md
@@ -8,18 +8,18 @@ Instructions can be in 7 different formats:
4. 3 bytes:\
4.1 Opcode(u8) + intermediate(u16)\
4.2 Opcode(u8) + data(u16)\
-4.3 Opcode(u8) + offset(i16)\
+4.3 Opcode(u8) + label(i16)\
4.4 Opcode(u8) + register(i8) + num_args(u8)
5. 4 bytes: Opcode(u8) + register(i8) + register(i8) + register(i8)
6. 4 bytes:\
-6.1 Opcode(u8) + register(i8) + offset(i16)\
+6.1 Opcode(u8) + register(i8) + label(i16)\
6.2 Opcode(u8) + register(i8) + intermediate(u16)\
6.3 Opcode(u8) + register(i8) + data(u16)\
6.4 Opcode(u8) + flags(u8) + num_local_var_reg(u16)
7. 5 bytes: Opcode(u8) + index(u16) + num_args(u8) + register(i8)
## Registers
Registers have a range of 128. Local variables start from register 0 and increment while parameters start from -1
-and decrement.
+and decrement. Registers have the scope of functions and reset after instructions reach a new function (AMAL_OP_FUNC_START).
# Compiler flow
(Tokenize&parse -> Resolve AST -> Generate SSA -> Generate bytecode) -> Generate program\