The compiler sxc, for an advanced ActionScript 3.0 dialect, contains submodules for parsing, verifying/symbol solving, semantic data model and bytecode. What it does not still do is load/generate bytecode, where there is control flow graph to analyse. Is beginning another tool, sxweb, that generates JavaScript, using the same compiler submodules.
FAQ.
What's the purpose of this? The language is an ActionScript 3.0 dialect for its simplicity and flexibility (such as no need for ES2015 arrow functions and no need for explicitly binding to this).
The most exciting to mention are enums, structural types, static typing only, type inference, flexible object literal, flexible array literal and the compliant literal strings identifying enum constants. There are other features, such as user primitive classes, destructuring patterns, the built-in float4, light generic classes...
var fn: function(float4):void
fn = function({x,z}) trace(x, z)
generic function fn2(arg): string
generic function fn2(arg: string): string
generic function fn2(arg: RegExp): string
Sometimes it's useful to alias package's public:
namespace qu = 'qux.utils'
qu::setTimeout(fn)
Splitting class is same as in ActionScript 3.0:
final class C {
include 'cimpl1.sx'
include 'cimpl2.sx'
}
But when taking sources recursively in the same directory, exclude them: sxc src --exclude-sources src/cimpl1.sx --exclude-sources src/cimpl2.sx.
For fun you can meanwhile test the verifier, but not still publish code (like JavaScript or LLVM bitcode). At the phone you can just install Termux app and run:
$ pkg install nodejs
$ termux-setup-storage
$ git clone https://github.com/shockscript/sxweb --recurse-submodules
$ cd sxweb && npm install && npm link
$ cd /storage/emulated/0/demo
Then, if you've source files in ~/demo, just run sxweb . --omit or sxweb src --omit.
The compiler sxc, for an advanced ActionScript 3.0 dialect, contains submodules for parsing, verifying/symbol solving, semantic data model and bytecode. What it does not still do is load/generate bytecode, where there is control flow graph to analyse. Is beginning another tool, sxweb, that generates JavaScript, using the same compiler submodules.
FAQ.
What's the purpose of this? The language is an ActionScript 3.0 dialect for its simplicity and flexibility (such as no need for ES2015 arrow functions and no need for explicitly binding to
this
).The most exciting to mention are enums, structural types, static typing only, type inference, flexible object literal, flexible array literal and the compliant literal strings identifying enum constants. There are other features, such as user primitive classes, destructuring patterns, the built-in
float4
, light generic classes...Sometimes it's useful to alias package's
public
:Splitting class is same as in ActionScript 3.0:
But when taking sources recursively in the same directory, exclude them:
sxc src --exclude-sources src/cimpl1.sx --exclude-sources src/cimpl2.sx
.Enums are like follows:
For fun you can meanwhile test the verifier, but not still publish code (like JavaScript or LLVM bitcode). At the phone you can just install Termux app and run:
Then, if you've source files in
~/demo
, just runsxweb . --omit
orsxweb src --omit
.Let me know if you like it!