From d9f652919961a2947452ad3c4af4659f3d2fb330 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 24 Aug 2019 23:31:14 +0200 Subject: Add if/else/elseif/while, including the final assembly --- doc/Documentation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/Documentation.md') 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\ -- cgit v1.2.3