   jsWithAstTypes ctx, ast, compiled
 
 compileTopLevelAndExpression = (source) ->
-  [terms..., expression] = _terms astize tokenize source
+  (topLevelAndExpression source).compiled
+
+topLevelAndExpression = (source) ->
+  ast = astize tokenize "(#{source})", -1
+  [terms..., expression] = _terms ast
   compiledDefinitions = definitionList (ctx = new Context), pairs terms
   compiledExpression = topLevelExpression ctx, expression
-  jsWithAstTypes ctx, null, library + compiledDefinitions + compiledExpression
+  types: ctx._scope()
+  ast: ast
+  compiled: library + compiledDefinitions + compiledExpression
 
 jsWithAstTypes = (ctx, ast, js) ->
   types = values mapMap _type, ctx._scope()

  assigns: assigns ? []

topLevelExpression = (ctx, expression) ->
  ctx.setName false
  compiled = expressionCompile ctx, expression
  ctx.resetName()
  compiled

topLevel = (ctx, form) ->

assignCompile = (ctx, expression, translatedExpression) ->
  # if not translatedExpression # TODO: throw here?
    #log expression
  if ctx.isAtDefinition()
    to = ctx.definitionPattern()

    ctx.setGroupTranslation()
    {precs, assigns} = patternCompile ctx, to, expression, translatedExpression

    #log "ASSIGN #{ctx.definitionName()}", ctx.shouldDefer()
    if ctx.shouldDefer()
      ctx.addDeferredDefinition ctx.shouldDefer().concat to, expression
      return 'deferred'
