Description
xas uses the
StringTemplate and a
ANTLR parser generator along with a AS grammar to translate the input source to one of the target languages.
The parser and lexer are C#.
What does it do?
xas will try and translate ActionScript source file(s) to one of the target languages. This will speed up porting of ActionScript to C++ by as much as 30 minutes or more per ActionScript source file. The current translation rate is about 75% and can
be improved by adding a second pass or tweaking the templates.
What does it not do?
If you are expecting a 100% compilable ready translation then this tool is not for you. xas is a tool to aid in the porting of ActionScript source file(s) to one of the target languages. You will need to do some work but not as much as manually porting single
files one at a time.
What do I need to do once translated?
You will need to manually check for types that did not get translated. For example, the Array type can contain any abitrary type. The Array type will be translated to vector<void*>. You will need to change this by looking at the context of the Array
and change the default type "void*" to what is expected.
To build in Visual Studio define from project settings add these defines.
ANTLR
ANTLR_DEBUG
Visual Studio 2010
This project is using Visual Studio 2010
Supported Target Languages
- C++
- C# (Not yet implemented)
- Java (Not yet implemented)
TODO
- fix known issues
Type Conversion
| Action Script |
C++ |
C# |
Java |
| Dictionary |
STL equivalent |
Dictionary |
Dictionary |
| String |
STL equivalent |
string |
String |
| XML |
This needs to be done while trying to maintain the semantics of the AS XML type |
XML |
XML |
| Array |
STL equivalent |
Array |
Array |
Usage
Translate single file
xas –nsomefile.as –o.
Translate multiple files.
xas –R –npath –o.
Options
n, name Required. Input file.
R, recurse Recurse looking for file(s).
v, verbose Verbose level. Range: from 0 to 2.
t, target Specify the output target (default C++)
o, output Specify the directory where translated files will be placed
(default is xas_output in current folder)
p, prefix Prefix accessors with set_ or get_
i, ignore If file has errors don't stop.
help Display this help screen.