logo
class

compiler::Parse

sys::Obj
  compiler::CompilerSupport
    compiler::CompilerStep
      compiler::Parse
  1  //
  2  // Copyright (c) 2006, Brian Frank and Andy Frank
  3  // Licensed under the Academic Free License version 3.0
  4  //
  5  // History:
  6  //   3 Jun 06  Brian Frank  Creation
  7  //
  8  
  9  **
 10  ** Parse is responsible for parsing all the compilation units which
 11  ** have already been tokenized into their full abstract syntax tree
 12  ** representation in memory.  Once complete this step populates the
 13  ** Compiler.types list with the list of declared types.
 14  **
 15  class Parse : CompilerStep
 16  {
 17  
 18  //////////////////////////////////////////////////////////////////////////
 19  // Construction
 20  //////////////////////////////////////////////////////////////////////////
 21  
 22    **
 23    ** Constructor takes the associated Compiler
 24    **
 25    new make(Compiler compiler)
 26      : super(compiler)
 27    {
 28    }
 29  
 30  //////////////////////////////////////////////////////////////////////////
 31  // Methods
 32  //////////////////////////////////////////////////////////////////////////
 33  
 34    **
 35    ** Run the step
 36    **
 37    override Void run()
 38    {
 39      log.verbose("Parse")
 40  
 41      types := TypeDef[,]
 42      closures := ClosureExpr[,]
 43  
 44      units.each |CompilationUnit unit|
 45      {
 46        Parser.make(compiler, unit, closures).parse
 47        types.addAll(unit.types)
 48      }
 49  
 50      bombIfErr
 51      compiler.types = types
 52      compiler.closures = closures
 53    }
 54  
 55  }

More Info

Slots