Title: MTASC
1MTASC
Nicolas Cannasse
Motion-Twin ActionScript Compiler
- No more Coffee Break while compiling
2Rich Internet Applications RIA
- AJAXDynamic HTML, RAD, Browser Integration
- FlashVector Engine, LowLevel, better control,
more powerful
3MTASC
- Is an ActionScript version 2 compiler
- Works from CommandLine
- Can be integrated in  your favorite IDE Â
- Is not an IDE
- Cant edit Flash Graphics or Code
- Is OpenSource
- GPL License, MotionTwin offering support
4The History of MTASC
- Prehistory ActionScript 1
- MiddleAge 09/2003 FlashMX2004 ActionScript2
- Need More Checks 12/2003 ASML
- Need More Types 04/2004 MotionTypes
- Back to AS2 10/2004 MTASC Beta 1
01/2005 MTASC 1.0 05/2005 FAME Platform /
OSFlash.org 07/2005 MTASC 1.09
5ASML ActionScriptMetaLanguage
- December 2003
- Run before Macromedia Compiler
- Add  Type Inference to AS2
- Check number of parameters (no optional
parameters) - Faster compilation process
6Type Inference
- To  Guess the types at compilation time
function length(o) return Math.sqrt(o.xo.x
o.yo.y)
7Type Inference
- To  Guess the types at compilation time
function length(o Tmp) Number return
Math.sqrt(o.xo.x o.yo.y) Tmp var x
Number var y Number
8Type Inference
- Pros
- Do not write Types
- Your program is still checked
- Changes propagate everywhere
- Cons
- You need to understand how it works
- Error reporting is difficult
- Typing order matters
9MotionTypes
- April 2004
- More Types need more Syntax
- Different Language ( .mt files )
- Anonymous Types var o x Number, y
Number - Lambda Types var onConnect Boolean -gt Void
- First AS1 generation, then SWF generation
10MTASC
- Back to AS2 compatibility
- Improves Macromedia Compiler
- Faster
- More strict
- Use SWF generation developed for MotionTypes
- Ready for RIA
- V2 Components
- ActionStep
11MTASC Internals
- Bunch of AS text files
- Lexing produce tokens
- Parsing build AST
- Typing type-check the AST
- SWF Code-Generation
- MTASC is Written in OCAML (www.ocaml.org)
12Flash Bytecode
function add x reg0 y reg1 push reg0
push reg1 add ret
- function add(x,y)
- return x y
Stack-based Virtual Machine. Registers for local
variables (since Flash7).
13Flash Bytecode
function max x reg0 y reg1 push reg0
push reg1 lt condjump 2 push
reg1 ret push reg0 ret
- function max(x,y)
- if( x lt y )
- return y
- else
- return x
Conditional Jumps
14From AS2 to AS1
if( !Ref ) _global.Ref function(r)
this.r r Ref.prototype.add function(p)
this.r this.r p.r
- class Ref
- var v Number
-
- function Ref(v)
- this.v v
-
-
- function add(r Ref)
- r p.r
-
AS2 is Class-based AS1 is Prototype-based
15From AS1 to SWF
push Ref eval not compjump XXX push
_global eval push Ref function (rr1)
thisr0 push r0 push r push
r1 objset objset . . . .
if( !Ref ) _global.Ref function(r)
this.r r Ref.prototype.add function(p)
this.r this.r p.r
16MTASC in Numbers
- MTASC sources (without libs) are
- 8 files
- 113 Ko
- 20000 words
- 4000 lines
- It takes 3-4 seconds for compiling more than 300
Classes (20-30 seconds with Macromedia Compiler)
17The FAMES Platform
- A complete OpenSource platform
- Flashout SWF Preview, Log
- ASDT AS2 Dev. Eclipse plugin
- MTASC AS2 Compiler
- Eclipse IDE
- SwfMill Resources (Fonts, JPEG,)
18The FAMES Platform
- A complete OpenSource platform
- Open Source IDE and Tools
- Edit / Compile / Test
- Ready for RIA dev
- Using Macromedia V2 Components (need license)
- Using OS Components
- More complete everyday
- See http//osflash.org
19Flash OpenSource Tools
- A lot of tools Available on OSFlash.org
- General Purpose
- AS2Lib, ASUnit
- UI Frameworks
- ActionStep, EnFlash, ARP, AsWing
- Debug/Log
- AdminTool
- Protocols
- AMFPHP, OpenAMF
- Tutorials, tips,
20Questions ?