Noel
Actually, there is no scripting language yet. Just a basic compiler that can parse some basic-like syntax into opcode.
It currently takes the basic program
and generates these opcodes
The VM simulate a cpu containing the necessary LIFO Stacks (Array), Registers/Stack Pointers(Variables), and Functions to process Pcode. Generating opcode may be optional.
Using 'compiled' Pcode files will provide greater performance than 'interpreting' the scripting language on the fly. Compilation is only required once.
This is a good start, lots to add.
Actually, there is no scripting language yet. Just a basic compiler that can parse some basic-like syntax into opcode.
It currently takes the basic program
let a=1 let b=2 let c=a*b+a/b if a=b then print a else print b end
and generates these opcodes
//tbasic startup...1 sub edx,edx //let a=1 mov eax,1 mov [_a],eax //let b=2 mov eax,2 mov [_b],eax //let c=a*b+a/b mov eax,[_a] push eax mov eax,[_b] pop ecx imul eax,ecx push eax mov eax,[_a] push eax mov eax,[_b] mov ecx,eax pop ecx shl eax,ecx pop ecx add eax,ecx mov [_c],eax //if a<b then print a else print b mov eax,[_a] push eax mov eax,[_b] pop ecx cmp ecx,eax slt eax and eax,255 and eax,eax jz __1 call print:64 mov eax,[_a] jmp __2 __1: call print:64 mov eax,[_b] __2: //end ret _a: dd 0 _b: dd 0 _c: dd 0 Done!Pcode is merely a numerical representation of these opcodes
;opcode mov eax,2 ;pcode equivalent 01 2
The VM simulate a cpu containing the necessary LIFO Stacks (Array), Registers/Stack Pointers(Variables), and Functions to process Pcode. Generating opcode may be optional.
Using 'compiled' Pcode files will provide greater performance than 'interpreting' the scripting language on the fly. Compilation is only required once.
This is a good start, lots to add.