org.apache.royale.compiler.package.html Maven / Gradle / Ivy
Show all versions of compiler Show documentation
This package and its subpackages contain the Royale compiler.
The Royale compiler compiles Royale code consisting of .mxml
.as
, .css
, .fxg
, and
.properties
files into SWF and SWC files.
The main entry point for compiling a SWF is in the MXMLC
class
in the package org.apache.royale.compiler.clients
.
The main entry point for compiling a SWC is in the COMPC
class
in the same package.
The corresponding Ant tasks are in the package org.apache.royale.compiler.ant
.
The org.apache.royale.compiler
package makes use of the libraries
in the org.apache.royale.abc
, org.apache.royale.swf
,
and org.apache.royale.swc
packages to read and write the ABC, SWF,
and SWC formats. However, these support libraries are independent of the compiler.
The Royale Compiler is a large body of code but it is organized around ten core
concepts, with a subpackage for each one:
Workspace
org.apache.royale.compiler.workspaces
The root object of the compiler's data structures. Owns projects to be compiled.
Project
org.apache.royale.compiler.projects
Owns compilation units to be compiled into one or more targets.
Target
org.apache.royale.compiler.targets
Manages the compilation of a set of compilation units into a SWF or SWC.
Compilation Unit
org.apache.royale.compiler.units
Manages the compilation of a single file.
This typically involves building an AST and a file scope,
performing semantic analysis to discover problems,
and code-generating ABC for a DoABC
SWF tag.
AST
org.apache.royale.compiler.tree
Represents almost every detail of a source file as a tree of nodes.
Scope
org.apache.royale.compiler.scopes
Organizes definitions -- named things declared in source code --
in a hierarchy that reflects the block structure of the source file.
Scopes and definitions comprise a symbol table that allow
AST nodes representing identifiers in the source code
to be resolved to definitions (i.e., what they mean).
A file scope contains the definitions defined with a single file.
A project scope contains definitions that are visible between files.
Definition
org.apache.royale.compiler.definitions
Represents a named object in a scope,
such as a class, interface, function, variable, etc.
Semantic Analysis
org.apache.royale.compiler.analysis
Resolves identifier nodes in an AST to definitions in a scope
(and quite a bit more.)
Problem
org.apache.royale.compiler.problems
Represents an error or warning.
Most problems are found during semantic analysis.
Code Generation
org.apache.royale.compiler.codegen
Reduces an AST to ABC, using scopes and definitions
to understand what each node means.
The bulk of code generation is handled by a BURM (Bottom-Up Rewrite Machine).
For more information, see the description of each of these packages.
The compiler code is organized into "external" and "internal" packages.
The internal packages are all within org.apache.royale.compiler.internal
.
For example, org.apache.royale.compiler.definitions
is an external package
that contains the definition interfaces for clients of the compiler to use;
org.apache.royale.compiler.internal.definitions
is its internal counterpart
that contains the definition classes that the compiler itself creates.
Clients should never use code in an internal package; if it becomes necessary to do so,
the code should be moved to an external package.
The distinction can be important: in the case of definitions, for example,
the methods in the interfaces are guaranteed to be safe to call
from multiple threads, while the methods in the classes are not.