Adding a language to AVM2

I am interested in creating a language on AVM2, and I am looking for advice on where to start. I really understand that this is by no means a trivial task, but I would like to try and at least learn more about introducing the language along this path.

I ran into ANTLR and read about syntax issues for language development. What I'm looking for is tips on the way to use or useful links / books.

For example, I would like to generate (script / manually) some very simple AVM2 bytecode and get it to run as a start on a virtual machine.

thanks

+4
source share
3 answers

If you are not interested in haXe, you basically need to write your own compiler that compiles objects before ABC (ActionScript Byte Code). AVM2 Review is a document available from Adobe on ABC and AVM2, which should help you get started. This is a fairly detailed document, but watch out for a few typos in the bytecode instructions.

You will also need to wrap the bytecode in the doABC tag as part of the SWF container. You can get more information from the SWF File Format documentation.

If you want the opening chapter to write data structures (optimized int formats, etc.), feel free to check out the code in asmock, the dynamic, ridiculous project I'm working on. The SWF / ByteCode generation material is a bit dirty, but there are IDataOutput wrappers ( SWF , ByteCode ) that may come in handy.

+4
source

Take a look at haXe : it is an open source language that can target a variety of platforms, including AVM. You can delve into the source code of the SWF compiler to get inspiration.

+1
source

Adobe's Alchemy project may be a good link http://labs.adobe.com/technologies/alchemy/

How did everything go? I am also interested in compiling Java in AVM2 ... Do you have published code?

+1
source

All Articles