Cappuccino - Interpreter/Assembler
Posted: Wed Sep 06, 2006 7:35 pm
Cappuccino is an interpreter I've written in PB, it's nowhere near complete yet but I'm hoping this release will generate some interest with some people who'd be able to help introduce some more advanced features (specifically GUI/graphics commands).
The download has three files in it. First, Code.txt. Write your test code (I've written some as an example) in here. Second, Assembler.exe. This translates Code.txt into ByteCode and outputs into a new file (Script). Finally, run VM.exe to run the script.
The Code has the following syntax (it's based on ASM):
Cappuccino ASM supports the following commands:
Interger maths: ADD, SUB, MUL, DIV
Float maths: FADD, FSUB, FMUL, FDIV
General: JMP, Mov
There are also 15 registers to play with (although 3 have a specific usage):
Long registers: L0, L1, L2, L3, L4
Float registers: F0, F1, F2, F3, F4
String registers: S0, S1, S2, S3, S4
The '0' registers will hold the result of a command excecuted via a call:
I'm going to continue to develop this and (eventually) make a high-level language and compiler which'll output Cappuccino ASM code and make use of the VM.
Enjoy!
DOWNLOAD
The download has three files in it. First, Code.txt. Write your test code (I've written some as an example) in here. Second, Assembler.exe. This translates Code.txt into ByteCode and outputs into a new file (Script). Finally, run VM.exe to run the script.
The Code has the following syntax (it's based on ASM):
Code: Select all
'This is a comment
Title "Not nessacary, and uneeded in this early version"
StackSize 1024 'Again, not nessacary
Entry Start 'Not nessacary, but usefull
.data 'This section is where you declare variables
One.l
Two.f
Three.s
.code 'This is where you write your code
Start: 'This is a label
Add One,1
.end 'Nothing after this line
Interger maths: ADD, SUB, MUL, DIV
Float maths: FADD, FSUB, FMUL, FDIV
General: JMP, Mov
There are also 15 registers to play with (although 3 have a specific usage):
Long registers: L0, L1, L2, L3, L4
Float registers: F0, F1, F2, F3, F4
String registers: S0, S1, S2, S3, S4
The '0' registers will hold the result of a command excecuted via a call:
Code: Select all
Push 97
Call [Chr] 'Supported calls are MessageBox, Len, Chr and Asc
'S0 now holds "a"
Enjoy!
DOWNLOAD