need help with array compiler in flash

=?ISO-8859-15?Q?Michael_L=FCftenegger?= <>
Thu, 29 Nov 2007 21:17:28 +0100

          From comp.compilers

Related articles
need help with array compiler in flash (=?ISO-8859-15?Q?Michael_L=FCftenegger?=) (2007-11-29)
Re: need help with array compiler in flash (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2007-12-01)
| List of all articles for this month |

From: =?ISO-8859-15?Q?Michael_L=FCftenegger?= <>
Newsgroups: comp.compilers
Date: Thu, 29 Nov 2007 21:17:28 +0100
Organization: Compilers Central
Keywords: question

Hi all!

To come to my proble:
I am working on a flash project for three years. And for this project i
developed a virtual machine in actionscript (I know it sounds strange,
but that's the way it is and it is working well!). This VM is executing
code on asm niveau but flash doesn't know binary data and so i am
storing my code in arrays. It looks like this:

script = new Array();
script[0] = ["push", "Hello ", "push", "world!", "add", "trace"];
script[1] = ["push", 4, "push", 1, "mul"];
script[2] = [ "push", 11, "fork", "jmp", "push", "I am the parent",
"trace", "push", 14, "gto", "push "I am the child", "trace", "non"];

I have written a quick'n'dirty compiler in PHP which generates the shown
code in a text file from a text file like this:
(I wrote this compiler to have labels.)

/* the compiler recognizes single line commands and multi
          lines commands
=0 // this is the first program. The number after the
"=" is used as index in the array.
        push "Hello "
        push "world!"

=1 /* the VM knows numbers and strings */
        push 4
        push 1

=2 /* The MV also knows forking */
        push a:
        push "I am the parent"
        push b:
a: push "I am the child"
b: non

During the last weeks I have read there are tools to generate compilers.
I would like to have a compiler which converts a programing language
from C niveau( no OOP, but if-then-else and for(){...}) to my array text
file. Does anybody know if there is a tool what meets my needs?



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.