Mtasc
Download
1 / 20

MTASC - PowerPoint PPT Presentation


  • 267 Views
  • Updated On :

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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'MTASC' - Roberta


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Mtasc l.jpg

Nicolas Cannasse

MTASC

No more Coffee Break while compiling

Motion-Twin ActionScript Compiler


Rich internet applications ria l.jpg
Rich Internet Applications – RIA

  • AJAXDynamic HTML, RAD, Browser Integration

  • FlashVector Engine, LowLevel, better control, more powerful


Mtasc3 l.jpg
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


The history of mtasc l.jpg
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


Asml actionscriptmetalanguage l.jpg
ASML : ActionScriptMetaLanguage

  • December 2003

  • Run before Macromedia Compiler

  • Add « Type Inference » to AS2

  • Check number of parameters (no optional parameters)

  • Faster compilation process


Type inference l.jpg
Type Inference

  • To « Guess » the types at compilation time

function length(o) {

return Math.sqrt(o.x*o.x + o.y*o.y);

}


Type inference7 l.jpg
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;

}


Type inference8 l.jpg
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


Motiontypes l.jpg
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


Mtasc10 l.jpg
MTASC

  • Back to AS2 : compatibility

  • Improves Macromedia Compiler :

    • Faster

    • More strict

  • Use SWF generation developed for MotionTypes

  • Ready for RIA :

    • V2 Components

    • ActionStep


Mtasc internals l.jpg
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)


Flash bytecode l.jpg
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).


Flash bytecode13 l.jpg
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


From as2 to as1 l.jpg
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


From as1 to swf l.jpg
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;

}

}


Mtasc in numbers l.jpg
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)


The fames platform l.jpg
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,…)


The fames platform18 l.jpg
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


Flash opensource tools l.jpg
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, …