It has registers! It has instructions! It has bytecodes! It has Assembly!
βββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Registers β De-comp β
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ββββββββββββββ¬βββββββββββ β ββββββ¬βββββββββ¬ββββββββββββββββ¬βββββββββββ¬ββββββββ β
β β Register β Value β β β PC β ADDR β OPCODE β ARG 0 β ARG 1 β β
β ββββββββββββββΌβββββββββββ€ β ββββββΌβββββββββΌββββββββββββββββΌβββββββββββΌββββββββ€ β
β β INST_PTR β 0000000C β β β β 0000: β SETREG_R_C β GP_I32_1 β 255 β β
β β FLAGS_0 β 00000000 β β β β 0006: β MEM_WRITE_R_C β GP_I32_1 β 0 β β
β β RESERVED_0 β 00000000 β β β > β 000C: β HALT β β β β
β β RESERVED_1 β 00000000 β β ββββββ΄βββββββββ΄ββββββββββββββββ΄βββββββββββ΄ββββββββ β
β β GP_I32_0 β 00000000 β β β
β β GP_I32_1 β 000000FF β β β
β β GP_I32_2 β 00000000 β β β
β ββββββββββββββ΄βββββββββββ β β
βββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββ ββββββββ¬βββββββββββββ¬βββββββββββββββ βββ Program Syntax Translation
β int globalVarA; β β SETREG GP_I32_0 0x00 β β char β Code β Words β β βββ .:: Everything in the program
β fn main():void { β β MEM_WRITE GP_I32_0 0x00 β ββββββββΌβββββββββββββΌβββββββββββββββ€ β βββ .::VAR DEF | globalVarA : int = (nothing)
β globalVarA = 42; β β LBL .::main β β 3 β int β Type β β βββ .::fn main (void ) => void
β int other = 420; β β SETREG GP_I32_0 0x2A β β 14 β globalVarA β VarName β β β βββ fn_main::VAR ASSIGNMENT | globalVarA = Const Expr (42)
β int lv_demo=globalVarA; β β MEM_WRITE GP_I32_0 0x00 β β 15 β ; β EndLine β β β βββ fn_main::VAR DEF | other : int = Const Expr (420)
β other_func(); β β SETREG GP_I32_0 0x1A4 β β 19 β fn β Function β β β βββ fn_main::VAR DEF | lv_demo : int = VarExp (globalVarA)
β } β β MEM_WRITE GP_I32_0 0x01 β β 24 β main β VarName β β β βββ fn_main::other_func (void)
β fn other_func ( ) : void { β β MEM_READ GP_I32_0 0x00 β β 25 β ( β OpenParen β β βββ .::fn other_func (void ) => void
β int x=20; β β MEM_WRITE GP_I32_0 0x02 β β 26 β ) β CloseParen β β βββ fn_other_func::VAR DEF | x : int = Const Expr (20)
β int y; β β CALL .::other_func β β 27 β : β OfType β β βββ fn_other_func::VAR DEF | y : int = (nothing)
β } β β RET β β 31 β void β Type β βββ Var Table
βββββββββββββββββββββββββββββββ β SETREG GP_I32_0 0x2A β β 33 β { β OpenBracket β β βββ ββββββββββββββββββββ¬βββββββββββ
β MEM_WRITE GP_I32_0 0x00 β β 49 β globalVarA β VarName β β β Fullname β Var Slot β
β SETREG GP_I32_0 0x1A4 β β 51 β = β Assignment β β ββββββββββββββββββββΌβββββββββββ€
β MEM_WRITE GP_I32_0 0x01 β β 54 β 42 β TypedValue β β β .::globalVarA β 000 β
β MEM_READ GP_I32_0 0x00 β β 55 β ; β EndLine β β β fn_main::other β 001 β
β MEM_WRITE GP_I32_0 0x02 β β 64 β int β Type β β β fn_main::lv_demo β 002 β
β CALL .::other_func β β 70 β other β VarName β β β fn_other_func::x β 003 β
β LBL .::other_func β β 72 β = β Assignment β β β fn_other_func::y β 004 β
β SETREG GP_I32_0 0x14 β β 76 β 420 β TypedValue β β ββββββββββββββββββββ΄βββββββββββ
β MEM_WRITE GP_I32_0 0x03 β β 77 β ; β EndLine β βββ Function Table
β SETREG GP_I32_0 0x00 β β 86 β int β Type β β βββ βββββββββββββ¬βββββββββββββ
β MEM_WRITE GP_I32_0 0x04 β β 94 β lv_demo β VarName β β β NAMESPACE β FN NAME β
β RET β β 95 β = β Assignment β β βββββββββββββΌβββββββββββββ€
β SETREG GP_I32_0 0x14 β β 105 β globalVarA β VarName β β β . β main β
β MEM_WRITE GP_I32_0 0x03 β β 106 β ; β EndLine β β β . β other_func β
β SETREG GP_I32_0 0x00 β β 122 β other_func β VarName β β βββββββββββββ΄βββββββββββββ
β MEM_WRITE GP_I32_0 0x04 β β 123 β ( β OpenParen β βββ Statement List
β β β 124 β ) β CloseParen β βββ ASM
βββββββββββββββββββββββββββ β 125 β ; β EndLine β βββ TokenInfo
β 128 β } β CloseBracket β βββ Everything in the program
β 132 β fn β Function β β βββ STATEMENTS:
β 143 β other_func β VarName β βββ VAR DEF | globalVarA : int = (nothing)
β 145 β ( β OpenParen β β βββ STATEMENTS:
β 147 β ) β CloseParen β β βββ SETREG GP_I32_0 0x00
β 149 β : β OfType β β βββ MEM_WRITE GP_I32_0 0x00
β 154 β void β Type β βββ fn main (void ) => void
β 156 β { β OpenBracket β β βββ STATEMENTS:
β 165 β int β Type β β βββ LBL .::main
β 167 β x β VarName β β βββ SETREG GP_I32_0 0x2A
β 168 β = β Assignment β β βββ MEM_WRITE GP_I32_0 0x00
β 170 β 20 β TypedValue β β βββ SETREG GP_I32_0 0x1A4
β 171 β ; β EndLine β β βββ MEM_WRITE GP_I32_0 0x01
β 180 β int β Type β β βββ MEM_READ GP_I32_0 0x00
β 182 β y β VarName β β βββ MEM_WRITE GP_I32_0 0x02
β 183 β ; β EndLine β β βββ CALL .::other_func
β 186 β } β CloseBracket β β βββ RET
ββββββββ΄βββββββββββββ΄βββββββββββββββ βββ VAR ASSIGNMENT | globalVarA = Const Expr (42)
β βββ STATEMENTS:
β βββ SETREG GP_I32_0 0x2A
β βββ MEM_WRITE GP_I32_0 0x00
βββ VAR DEF | other : int = Const Expr (420)
β βββ STATEMENTS:
β βββ SETREG GP_I32_0 0x1A4
β βββ MEM_WRITE GP_I32_0 0x01
βββ VAR DEF | lv_demo : int = VarExp (globalVarA)
β βββ STATEMENTS:
β βββ MEM_READ GP_I32_0 0x00
β βββ MEM_WRITE GP_I32_0 0x02
βββ other_func (void)
β βββ STATEMENTS:
β βββ CALL .::other_func
βββ fn other_func (void ) => void
β βββ STATEMENTS:
β βββ LBL .::other_func
β βββ SETREG GP_I32_0 0x14
β βββ MEM_WRITE GP_I32_0 0x03
β βββ SETREG GP_I32_0 0x00
β βββ MEM_WRITE GP_I32_0 0x04
β βββ RET
βββ VAR DEF | x : int = Const Expr (20)
β βββ STATEMENTS:
β βββ SETREG GP_I32_0 0x14
β βββ MEM_WRITE GP_I32_0 0x03
βββ VAR DEF | y : int = (nothing)
βββ STATEMENTS:
βββ SETREG GP_I32_0 0x00
βββ MEM_WRITE GP_I32_0 0x04
Compiled Ok!
Verifying Assembly
........................................................................................................................................................Assembly ok
/*00:*/ 0xA3, 0x12, 0x00, 0x00, 0x00, // [CALL_C] CALL .::main
/*05:*/ 0xFF, // [HALT] HALT
/*06:*/ 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x00
/*0c:*/ 0xB7, 0x04, 0x00, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x00
/*12:*/ 0xA6, // [CALL_D] LBL .::main
/*13:*/ 0x01, 0x04, 0x2A, 0x00, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x2A
/*19:*/ 0xB7, 0x04, 0x00, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x00
/*1f:*/ 0x01, 0x04, 0xA4, 0x01, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x1A4
/*25:*/ 0xB7, 0x04, 0x01, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x01
/*2b:*/ 0xB5, 0x04, 0x00, 0x00, 0x00, 0x00, // [MEM_READ_R_C] MEM_READ GP_I32_0 0x00
/*31:*/ 0xB7, 0x04, 0x02, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x02
/*37:*/ 0xA3, 0x66, 0x00, 0x00, 0x00, // [CALL_C] CALL .::other_func
/*3c:*/ 0xA5, // [RET] RET
/*3d:*/ 0x01, 0x04, 0x2A, 0x00, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x2A
/*43:*/ 0xB7, 0x04, 0x00, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x00
/*49:*/ 0x01, 0x04, 0xA4, 0x01, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x1A4
/*4f:*/ 0xB7, 0x04, 0x01, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x01
/*55:*/ 0xB5, 0x04, 0x00, 0x00, 0x00, 0x00, // [MEM_READ_R_C] MEM_READ GP_I32_0 0x00
/*5b:*/ 0xB7, 0x04, 0x02, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x02
/*61:*/ 0xA3, 0x66, 0x00, 0x00, 0x00, // [CALL_C] CALL .::other_func
/*66:*/ 0xA6, // [CALL_D] LBL .::other_func
/*67:*/ 0x01, 0x04, 0x14, 0x00, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x14
/*6d:*/ 0xB7, 0x04, 0x03, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x03
/*73:*/ 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x00
/*79:*/ 0xB7, 0x04, 0x04, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x04
/*7f:*/ 0xA5, // [RET] RET
/*80:*/ 0x01, 0x04, 0x14, 0x00, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x14
/*86:*/ 0xB7, 0x04, 0x03, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x03
/*8c:*/ 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, // [SETREG_R_C] SETREG GP_I32_0 0x00
/*92:*/ 0xB7, 0x04, 0x04, 0x00, 0x00, 0x00, // [MEM_WRITE_R_C] MEM_WRITE GP_I32_0 0x04
Assembled Ok!
βββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β VAR TBL β FUNC TBL β
βββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β ββββββββββββ¬βββββββββββββββββββ¬ββββββββ β βββββββββββββ¬βββββββββββββ β
β β Var Slot β Fullname β Value β β β NAMESPACE β FN NAME β β
β ββββββββββββΌβββββββββββββββββββΌββββββββ€ β βββββββββββββΌβββββββββββββ€ β
β β 000 β .::globalVarA β 0 β β β . β main β β
β β 001 β fn_main::other β 0 β β β . β other_func β β
β β 002 β fn_main::lv_demo β 0 β β βββββββββββββ΄βββββββββββββ β
β β 003 β fn_other_func::x β 0 β β β
β β 004 β fn_other_func::y β 0 β β β
β ββββββββββββ΄βββββββββββββββββββ΄ββββββββ β β
βββββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REGISTERS β PROGRAM β
βββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ββββββββββββββ¬ββββββ¬βββββββββββ β βββββ¬ββββββ¬βββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββ¬ββββββββββββ¬ββββββββββββββββ¬ββββββββ β
β β REG β VAL β HEX β β β I β BS β INST BYTES β OP β ASM β ARG 0 β ARG 1 β β
β ββββββββββββββΌββββββΌβββββββββββ€ β βββββΌββββββΌβββββββββββββββββββββββββββββββββββββββΌββββββββββββββββΌββββββββββββΌββββββββββββββββΌββββββββ€ β
β β INST_PTR β 0 β 00000000 β β β > β 00: β 0xA3, 0x12, 0x00, 0x00, 0x00, β CALL_C β CALL β .::main β β β
β β FLAGS_0 β 0 β 00000000 β β β β 05: β 0xFF, β HALT β HALT β β β β
β β RESERVED_0 β 0 β 00000000 β β β β 06: β 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x00 β β
β β RESERVED_1 β 0 β 00000000 β β β β 0c: β 0xB7, 0x04, 0x00, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x00 β β
β β GP_I32_0 β 0 β 00000000 β β β β 12: β 0xA6, β CALL_D β LBL β .::main β β β
β β GP_I32_1 β 0 β 00000000 β β β β 13: β 0x01, 0x04, 0x2A, 0x00, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x2A β β
β β GP_I32_2 β 0 β 00000000 β β β β 19: β 0xB7, 0x04, 0x00, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x00 β β
β ββββββββββββββ΄ββββββ΄βββββββββββ β β β 1f: β 0x01, 0x04, 0xA4, 0x01, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x1A4 β β
β β β β 25: β 0xB7, 0x04, 0x01, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x01 β β
β β β β 2b: β 0xB5, 0x04, 0x00, 0x00, 0x00, 0x00, β MEM_READ_R_C β MEM_READ β GP_I32_0 β 0x00 β β
β β β β 31: β 0xB7, 0x04, 0x02, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x02 β β
β β β β 37: β 0xA3, 0x66, 0x00, 0x00, 0x00, β CALL_C β CALL β .::other_func β β β
β β β β 3c: β 0xA5, β RET β RET β β β β
β β β β 3d: β 0x01, 0x04, 0x2A, 0x00, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x2A β β
β β β β 43: β 0xB7, 0x04, 0x00, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x00 β β
β β β β 49: β 0x01, 0x04, 0xA4, 0x01, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x1A4 β β
β β β β 4f: β 0xB7, 0x04, 0x01, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x01 β β
β β β β 55: β 0xB5, 0x04, 0x00, 0x00, 0x00, 0x00, β MEM_READ_R_C β MEM_READ β GP_I32_0 β 0x00 β β
β β β β 5b: β 0xB7, 0x04, 0x02, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x02 β β
β β β β 61: β 0xA3, 0x66, 0x00, 0x00, 0x00, β CALL_C β CALL β .::other_func β β β
β β β β 66: β 0xA6, β CALL_D β LBL β .::other_func β β β
β β β β 67: β 0x01, 0x04, 0x14, 0x00, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x14 β β
β β β β 6d: β 0xB7, 0x04, 0x03, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x03 β β
β β β β 73: β 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x00 β β
β β β β 79: β 0xB7, 0x04, 0x04, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x04 β β
β β β β 7f: β 0xA5, β RET β RET β β β β
β β β β 80: β 0x01, 0x04, 0x14, 0x00, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x14 β β
β β β β 86: β 0xB7, 0x04, 0x03, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x03 β β
β β β β 8c: β 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, β SETREG_R_C β SETREG β GP_I32_0 β 0x00 β β
β β β β 92: β 0xB7, 0x04, 0x04, 0x00, 0x00, 0x00, β MEM_WRITE_R_C β MEM_WRITE β GP_I32_0 β 0x04 β β
β β βββββ΄ββββββ΄βββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββ΄ββββββββββββ΄ββββββββββββββββ΄ββββββββ β
βββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
STEP CONTINUE