1 / 20

MTASC

Nicolas Cannasse. MTASC. No more Coffee Break while compiling. M otion- T win A ction S cript C ompiler. Rich Internet Applications – RIA . AJAX Dynamic HTML, RAD, Browser Integration Flash Vector Engine, LowLevel, better control, more powerful. MTASC.

mattox
Download Presentation

MTASC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Nicolas Cannasse MTASC No more Coffee Break while compiling Motion-Twin ActionScript Compiler

  2. Rich Internet Applications – RIA • AJAXDynamic HTML, RAD, Browser Integration • FlashVector Engine, LowLevel, better control, more powerful

  3. MTASC • Is an ActionScript version 2 compiler • Works from CommandLine • Can be integrated in « your favorite IDE  » • Is not an IDE : • Can’t edit Flash Graphics or Code • Is OpenSource • GPL License, MotionTwin offering support

  4. The 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

  5. ASML : ActionScriptMetaLanguage • December 2003 • Run before Macromedia Compiler • Add « Type Inference » to AS2 • Check number of parameters (no optional parameters) • Faster compilation process

  6. Type Inference • To « Guess » the types at compilation time function length(o) { return Math.sqrt(o.x*o.x + o.y*o.y); }

  7. Type Inference • To « Guess » the types at compilation time function length(o : Tmp) : Number { return Math.sqrt(o.x*o.x + o.y*o.y); } Tmp { var x : Number; var y : Number; }

  8. Type 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

  9. MotionTypes • April 2004 • More Types need more Syntax • Different Language ( .mt files ) • Anonymous Types :var o : { x : Number, y : Number }; • Lambda Types :var onConnect : Boolean -> Void; • First AS1 generation, then SWF generation

  10. MTASC • Back to AS2 : compatibility • Improves Macromedia Compiler : • Faster • More strict • Use SWF generation developed for MotionTypes • Ready for RIA : • V2 Components • ActionStep

  11. MTASC 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)

  12. Flash 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).

  13. Flash 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 < y ) return y; else return x; } Conditional Jumps

  14. From 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

  15. From AS1 to SWF push ‘Ref’ eval not compjump +XXX push ‘_global’ eval push ‘Ref’ function (r:r1) this:r0 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; } }

  16. MTASC in Numbers • MTASC sources (without libs) are : • 8 files • 113 Ko • 20’000 words • 4’000 lines • It takes 3-4 seconds for compiling more than 300 Classes (20-30 seconds with Macromedia Compiler)

  17. The FAMES Platform A complete OpenSource platform : • Flashout : SWF Preview, Log • ASDT : AS2 Dev. Eclipse plugin • MTASC : AS2 Compiler • Eclipse : IDE • SwfMill : Resources (Fonts, JPEG,…)

  18. The 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

  19. Flash 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, …

  20. Questions ?

More Related