The Flex compiler, which is often referred to as mxmlc, is a collection of subcompilers, used to create a SWF. The two main subcompilers are flex2.compiler.as3.Compiler, which compiles .as files, and flex2.compiler.mxml.Compiler, which compiles .mxml files. The flex2.compiler.abc.Compiler is used to extract type information from precompiled ABC (ActionScript Byte Code), like from SWC files. The flex2.compiler.css.Compiler is used to compile Runtime CSS SWF's. The flex2.compiler.i18n.Compiler is used to compile translation files, usually .properties files.
Each of the subcompilers implements a common interface, flex2.compiler.Compiler. This interface declares a method for each phase of compilation: preprocess, parse1, parse2, analyze1, analyze2, analyze3, analyze4, generate, and postprocess. Historically most of these phases line up with how ASC is designed. A flex2.compiler.Source is passed into preprocess() and parse1(). It represents a single file from the CompilerSwcContext (flex2.compiler.CompilerSwcContext), FileSpec (flex2.compiler.FileSpec), SourceList (flex2.compiler.SourceList), or SourcePath (flex2.compiler.SourcePath). The parse1() is suppose to return a CompilationUnit, which is then passed into each of the following phase methods. The analyze phase methods register the type dependencies of the CompilationUnit. The generate phase method emits byte code.
Most of the subcompilers wrap an instance of flex2.compiler.as3.Compiler. In each of the phase methods, some work is potentially done and then the same phase method is called on the wrapped AS3 compiler. For example, in flex2.compiler.mxml.InterfaceCompiler.parse1(), the mxml document is parsed, an AS skeleton is generated, and then parse is called on the wrapped As3 compiler with the skeleton.
Each of the subcompilers implements a common interface, flex2.compiler.Compiler. This interface declares a method for each phase of compilation: preprocess, parse1, parse2, analyze1, analyze2, analyze3, analyze4, generate, and postprocess. Historically most of these phases line up with how ASC is designed. A flex2.compiler.Source is passed into preprocess() and parse1(). It represents a single file from the CompilerSwcContext (flex2.compiler.CompilerSwcContext), FileSpec (flex2.compiler.FileSpec), SourceList (flex2.compiler.SourceList), or SourcePath (flex2.compiler.SourcePath). The parse1() is suppose to return a CompilationUnit, which is then passed into each of the following phase methods. The analyze phase methods register the type dependencies of the CompilationUnit. The generate phase method emits byte code.
Most of the subcompilers wrap an instance of flex2.compiler.as3.Compiler. In each of the phase methods, some work is potentially done and then the same phase method is called on the wrapped AS3 compiler. For example, in flex2.compiler.mxml.InterfaceCompiler.parse1(), the mxml document is parsed, an AS skeleton is generated, and then parse is called on the wrapped As3 compiler with the skeleton.