         result
 
   # Start the continuation loop and return its result.
-  doNext(null, inputText)
+  doNext(null, initialValue)
 
 
 PalCompiler.parse = (inputText, cb) ->
   try
     ast = PalParser.parse inputText, 'program'
   catch err
-    return cb err
+    return cb(err)
+
+    # Rethrow the error if it happens to be an error I made while programming
+    # this thing. :/
 
   cb null, ast
 
 PalCompiler.generateJS = (ast, cb) ->
+  JSCodeGenerator = require './js-code-generator'
+
   codeGenerator = new JSCodeGenerator
   src = codeGenerator.compile ast
 

#  object will have a field 'where' that signifies which stage of processing
#  it failed.
#
PalCompiler = (inputText, options={}) ->
  result =
    ast: null
    src: null
    fn: null
    error: null

  stages = [
    ['ast', PalCompiler.parse],
    ['src', PalCompiler.generateJS]
    ['fn',  PalCompiler.createFn]
  ]

  # Set up the initial state of the weird continuation loop thing.
  stageNo = 0


  cb null, fn

PalCompiler.semanticAnalysis = (ast, cb) ->
  # TODO: Semantic Analysis has not yet been defined.
  cb null, ast # Pass the AST unchanged.

# These are all of the possible compilation stages, from the above properties.
compilationStage =
  parse:
    ['ast', PalCompiler.parse]
  # Depends on 'parsing'
  analyze:
    ['sast', PalCompiler.semanticAnalysis]
  # Depends on 'parsing'... should depend on 'semanticAnalysis'
  generateJS:
    ['src', PalCompiler.generateJS]
  # Depends on 'codeGeneration'
  eval:
    ['fn',  PalCompiler.createFn]



# Export the compiler code.
module.exports = PalCompiler
