Skip to content
Zwetan Kjukov edited this page Aug 23, 2018 · 7 revisions

What is Redtamarin?

The one page that explains it all.

Redtamarin is a project that span many outlets, is it a tool?, is it a new AS3 library?, is it a server-side technology? does it display things on the screen? what can I do with it? where can I use it? and many more questions...

This page is here to answer everything in a simple manner.

The Redtamarin project

In 2006 Adobe open sourced the ActionScript Virtual Machine 2 (AVM2) under a project named Tamarin, that you can find now on Github under the name avmplus.

The goal of the "Tamarin" project is to implement a high-performance, open source implementation of the ECMAScript 4th edition (ES4) language specification. The Tamarin virtual machine will be used by Mozilla within SpiderMonkey, the core JavaScript engine embedded in Firefox®, and other products based on Mozilla technology. The code will continue to be used by Adobe as part of the ActionScript™ Virtual Machine within Adobe® Flash® Player.

The Tamarin virtual machine currently implements the ECMAScript 3rd edition language standard that is the basis for JavaScript, Adobe ActionScript, and Microsoft Jscript, plus some of the new language features proposed in the ECMAScript 4th edition specification. By working on an open source implementation of ES4 with the community, Adobe and Mozilla hope to accelerate the adoption of a standard language for creating engaging Web applications. We hope the Tamarin project accelerates the ability of developers to create and deliver richer, more interactive experiences that work across multiple platforms.

In 2008, I started the redtamarin open source project based on the code base of Tamarin.

But the goal was different, it was (and still is) about providing native implementations and other libraries to support the use of the ActionScript 3.0 language for command-line tools, shell scripts and server-side programming.

Simply put, even if Tamarin/avmplus is about the implementation of a a Virtual Machine, Redtamarin focus is about reusing this VM to write programs and so provide the tools and libraries for the developers to be able to write those programs.

The Similarities

The Tamarin project is the open source AVM2, this ActionScript Virtual Machine is used by runtimes such as the Flash Player plugin and Adobe AIR.

Redtamarin, same as Tamarin, is mainly C/C++ and ActionScript 3.0 source code, and produce another runtime: the Redtamarin shell or redshell.

Those 3 runtimes share in common the use of AVM2 as their main engine and the possibility to interpret and execute ActionScript 3.0 programs compiled as ActionScript ByteCode (ABC) or SWF (binary format that can contains many ABC and other assets).

All those runtimes understand the built-ins ActionScript 3.0 classes like: Boolean, String, Number, Date, etc. as well as more advanced classes like ByteArray, Dictionary, Proxy, Workers, etc.

All those runtimes depend on the same compilers to produce the ABC or SWF: the ActionScript Compiler (ASC), the MXML Compiler (MXMLC), the Component Compiler (COMPC) that you can find in the open source Apache Flex project.

The Differences

The Flash Player is a runtime meant to run as a plugin inside a web browser and use a specific set of native libraries that we can call the Flash API.

The Adobe AIR runtime is meant to run out-of-browser as an independent runtime that can run under Windows, Mac OS X, Linux for the desktop and under iOS and Android for mobile. AIR stand for "Adobe Integrated Runtime", you can see as Flash but without the browser and also use a specific set of native libraries that we can call the AIR API.

The Redtamarin runtime or redshell is meant to run only on the command-line without a GUI (Graphical User Interface). Redshell is very similar to AIR as an independent runtime it can run under Windows, Mac OS X and Linux, and because there is no GUI can integrate where the Flash Player and Adobe AIR can not run: system process, service, daemon, shell scripts, server-side, etc. It also uses a specific set of native libraries that we call the Redtamarin API.

Those 3 runtimes reuse the same compiler tools but at different level.

With Flash and AIR you use in general MXMLC to produce SWF files.

And with redshell you use in general ASC to produce ABC files.

In general, with redshell you do things at a lower level.

The main differences will be about the API available to each runtimes: AIR can reuse all of the Flash API but Flash can not use the AIR API, redshell provide an API which can includes some compatibilities (for convenience) with the Flash and/or AIR API (see avmglue) but the main goal of the Redtamarin API is to be a cross-platform lower-level API (see our libraries).

What are the Benefits?

Redtamarin allow you to reuse your ActionScript 3.0 knowledge and source code to produce programs that works in environments where Flash and AIR could not run.

Even if your focus is mainly to build SWF file for the web and/or AIR applications for the desktop and/or mobile, you will probably need a 3rd component: a server.

The same logic that made you pick up Adobe AIR to produce mobile apps, eg. "We don't want to write 2x the same program, one for iOS and one for Android" can also be applied to the server-side or backend programming, you simply want to reuse your code not rewrite for another language.

Another kind of logic is to be fast, you can write shell scripts in Bash but you would probably produce faster results by reusing a language you know well like ActionScript 3.0, everything from automation, to custom tools to use in production and even server-side dynamic pages can benefit from reusing AS3.

What are the Non-Goals?

Redtamarin is not here to replace the Flash Player or Adobe AIR but to complete and/or accompany them.

Our focus on the command-line is based on our will to be useful where we are used.

When you run a shell script to automate some tasks on a server you will be more happy as a developer to be able to access POSIX functions than to be able to create and render an animated MovieClip.

With Redtamarin we reuse the AVM2, we reuse ActionScript 3.0 but we don't want to copy what already exists and works pretty well, eg. Flash and AIR.

For all those reasons supporting graphics, GUI and/or any kind graphical rendering is out of question.

Clarifications of Stuff

Here a list of few quick facts and stuff about all that technology.

  • AVM2 is the ActionScript Virtual Machine 2.0
  • AVM2 is what interpret ActionScript Bytecode (ABC)
    inside the Flash player, the AIR runtime and the Redtamarin shell.
  • you create ABC files by compiling ActionScript 3.0 source code
  • Tamarin is the open source AVM2
  • Tamarin does not contain the sources
    of the Flash or AIR API (no UI, no sound, no image, etc.)
  • Redtamarin is an open source project
  • Redtamarin extends Tamarin with native code (C++)
    for Windows, Mac OS X and Linux in 32-bit and 64-bit
  • Redtamarin provides a POSIX / C API
    (stdlib, stdio, unistd, socket, etc.)
  • Redtamarin provides native classes
    (Program, Runtime, OperatingSystem, etc.)
  • Redtamarin provides implementations of the Flash and AIR API
    (ByteArray, Proxy, Workers, etc.)
  • Redtamarin produces a runtime: redshell
  • Redshell can execute ABC, AS and SWF files
  • a SWF file is a container of multiple ABC files
  • you can merge the redshell with an ABC file
    to produce a static binary
  • the Redtamarin API allow you to eval AS3 source code at runtime

What can you do with it?

You can use redtamarin to run

  • command-line programs
    $ redshell myprogram.abc
  • static binaries
    $ myprogram
  • shell scripts
    $ myscript
  • server-side programs
AddHandler cgi-script .abc
Options +ExecCGI

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.abc [QSA,L]

Those are the tip of iceberg examples, the command-line provide great power to a programmer but in general this power come with a price: complexity.

Redtamarin will at the same time provide access to this complexity but also help make it less complex.

For example, as a developer you may need to write a command-line tool, you may start by learning C, how to compile it with gcc, then learn make, and bit by bit write your program.

But writing a C program for the command-line can be a whole other world, depending on the complexity of this program you will probably have to deal with pointers, learn to allocate and manipulate strings, make it work for Windows and Linux, etc.

All these can be big "barrier to entry" and sometimes can lead you to give up because of the complexity.

Redtamarin allow you to reuse something familiar like ActionScript 3.0 and reuse the redshell as runtime to run your program wether in 32-bit or 64-bit or in Windows, Mac OS X or Linux; in fact when you produce a program.abc it will work everywhere the runtime can run.

Also depending on taste or convenience you may prefer to generate

  • a static binary
    one single independent executable
    easy to distribute on a particular system
  • a shell script
    no need to compile the AS3 you can directly run it
    you will need to install as3shebang
  • an ABC file
    you need the redshell to run it
    but it can easily be shared between different systems
  • a SWF file
    same you need the redshell to run it
    but it allow to reuse ABC libraries to build your program

Where can you use it?

By default Redtamarin supports Windows, Mac OS X and Linux in both 32-bit and 64-bit.

Technically we can port Redtamarin to different architectures and operating systems like ARM, Sun Solaris, etc. we don't do it yet for lack of resources.

When we say "Windows, Mac OS X and Linux" it means it will work as well on the client-side than the server-side as long as you plan to run it on the command-line.

Yes, the command-line is our focus.

At this point if you're still not sure see it like that:
if the Flash Player or Adobe AIR can do whatever you want to do then use those tools
but if the Flash Player or Adobe AIR can not run "there" Redtamarin is probably the tool you want to use.

Clone this wiki locally