Page 1 of 1

Cappuccino - Interpreter/Assembler

Posted: Wed Sep 06, 2006 7:35 pm
by Killswitch
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):

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
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:

Code: Select all

    Push 97
    Call [Chr] 'Supported calls are MessageBox, Len, Chr and Asc
    'S0 now holds "a"
  
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

Posted: Wed Sep 06, 2006 8:26 pm
by GeoTrail
Looks abit complicated :shock: ;)
Anyways, why the name Cappuccino ?

Posted: Wed Sep 06, 2006 8:38 pm
by dracflamloc
He was probably sipping some while looking at a picture of Hasselhoff. :twisted:

Posted: Wed Sep 06, 2006 8:39 pm
by thefool
I cant make it compile :/

Posted: Wed Sep 06, 2006 8:54 pm
by Trond
GeoTrail wrote:Anyways, why the name Cappuccino ?
A VM, just like Java? (And his previous thing was called Mocha.)

Posted: Wed Sep 06, 2006 9:04 pm
by Killswitch
I've updated the assembler so it displays a message once the compilations finished. Just as a quick and dirty solution remember that all the code must be written in Code.txt, and the assembler will always output to the 'Script' file.

It'll admit it looks a bit complicated, I'm writing an ASM based language first so I can translate a higher language into it later on. The Cappuccino step will be like the FASM step with PB.

Cappuccino is a very lame and indirect reference to Java (since, it's a VM as well), as well as keeping in touch with some of my previous work (last two projects were called Mocha and Latte). I was wondering if someone would notice that - thanks Trond :)

Hopefully that should clear things up a little, if you're still having trouble compiling then please post any error messages your getting/the source I'll try and help as much as possible.

DOWNLOAD

Posted: Wed Sep 06, 2006 9:13 pm
by srod
Have you given up with Mocha then, as this seems a change in direction?

Posted: Wed Sep 06, 2006 9:21 pm
by thefool
works now :)

Posted: Wed Sep 06, 2006 9:26 pm
by Killswitch
I'd stopped working on Mocha quite a while ago, I shifted to a new codebase which I called 'Latte'. I'm still interested in writing a 'true' compiler, rather than an interpreter, but I lack the ASM knowledge to do it properly.

This project is designed to let me create a new language but also supply a code base which can easily be switched over to compile to FASM, hence the ASM syntax here.

If there's any demand for it I'll realse the source for Mocha and Latte.

How's everyone enjoying this project? :)

Posted: Wed Sep 06, 2006 9:36 pm
by newcoder
I like this project alot. I am doing this exact same thing. But just like you I want to be able to make a true compiler but my assembler knowledge is not that great.

I'm writing my vm in C though.

Posted: Wed Sep 06, 2006 10:24 pm
by GeoTrail
Trond wrote:
GeoTrail wrote:Anyways, why the name Cappuccino ?
A VM, just like Java? (And his previous thing was called Mocha.)
Aaa didn't see the similarity hehehehe. too obvious ;)
Personally, I prefer Espresso :D

Posted: Wed Sep 06, 2006 10:47 pm
by Killswitch
That's funny actually, I considered calling this Expresso but rejected the name on the basis that I hate it!

Posted: Thu Sep 07, 2006 1:33 am
by Inf0Byt3
YOU WILL GIVE ME ALL YOUR CAPPUCINO!

Image

This project looks really good! 8)