Skip to content

Building a compiler

Matheus Dias de Souza edited this page Jul 23, 2024 · 2 revisions

An ActionScript compiler does more than just parsing:

  • Verification, and SWF and SWC processing
  • Handling of three source file formats: ActionScript 3, MXML, and CSS
  • Output of several problems
  • Building of control flow graphs for each activation
  • Attachment of data to tree nodes.

Compiler options

Attach compiler options to a compilation unit by defining your own options data type and storing a reference of it by calling compilation_unit.set_compiler_options(Some(options)) where options: Rc<dyn Any>.

The parser project leaves the compiler options to be defined as part of the compiler.

SWF

The Ruffle player contains a swf package that reads and writes SWF from or into structures.

Domain Memory Operations

Detect domain memory operations to generate optimized AVM2 instructions.

Project Configuration

It is interesting to consider allowing project configurations in a dependency managed manner. Something similiar to asconfig.json from the Visual Studio AS&MXML extension, but in a different way to allow dependencies that include their own ActionScript 3 configuration (including options such as strict, and inferTypes).

IDE

Verification

If the last verification fails due to any syntax errors, keep the semantic database and node tree from the last verification.

Clone this wiki locally