\chapter{Vereinfachte Compilerschnittstelle}
\label{cha_compiler}

In diesem Abschnitt ist die Schnittstelle f"ur die vereinfachte
Compilerschnittstelle dargestellt.

\begin{alltt}
\textbf{interface} Compiler
{\slshape (* System : Tycoon Compiler TLMin
   File   : Compiler.ti
   Author : CK
   Date   : 12-NOV-1996
   Purpose: Interface to the TLMin Compiler
   Update : 
*)}
\textbf{export}
  Switches <:\textbf{Ok}
  Log <: \textbf{Ok}
  Source <:\textbf{Ok}
  Grammar <:\textbf{Ok}
  Parser <:\textbf{Ok}
  Environment <:\textbf{Ok}
  InitialEnvironment <:\textbf{Ok}
  Context <:\textbf{Ok}
  Bindings <:\textbf{Ok}
  SyntaxTree <:\textbf{Ok}
  TMLCode <:\textbf{Ok}
  TVMCode <:\textbf{Ok}
  Result <:\textbf{Ok}

  contextError :\textbf{Exception end}
  parseError :\textbf{Exception end}
  generateCodeError :\textbf{Exception end}
\end{alltt}
\newpage
\begin{alltt}
{\slshape (* functions to manipulate the compiler switches *)
(* switches used by type checker *)}
  setTypeCheck (context :Context value :Bool) :\textbf{Ok}
  setTraceSubType (context :Context value :Bool) :\textbf{Ok}
  setTraceType (context :Context value :Bool) :\textbf{Ok}
  setTraceValue (context :Context value :Bool) :\textbf{Ok}
  setTraceApply (context :Context value :Bool) :\textbf{Ok}
  setPrintIndices (context :Context value :Bool) :\textbf{Ok}
  setPrintBackendIndices (context :Context value :Bool) :\textbf{Ok}
  setCacheSubTyping (context :Context value :Bool) :\textbf{Ok}
  setCacheLocalSubTyping (context :Context value :Bool) :\textbf{Ok}
  setCacheExposing (context :Context value :Bool) :\textbf{Ok}

\textsl{(* switches used by tml-code-generation *)}
  setExpandTuningPos (context :Context value :Int) :\textbf{Ok}
  setExpandTuningPosRec (context :Context value :Int) :\textbf{Ok}
  setExpandTuningNeg (context :Context value :Int) :\textbf{Ok}
  setTraceReducer (context :Context value :Bool) :\textbf{Ok}
  setTraceExpander (context :Context value :Bool) :\textbf{Ok}
  setNotifyOptimization (context :Context value :Bool) :\textbf{Ok}

\textsl{(* switches used by backend *)}
  setPrintTVM (context :Context value :Bool) :\textbf{Ok}
  setExecutionLoops (context :Context value :Int) :\textbf{Ok}

\textsl{(* other switches *)}
  setTypedOutput (context :Context value :Bool) :\textbf{Ok}
  setTypedOutputDepth (context :Context value :Int) :\textbf{Ok}

  sourceFromFile(name :String) :Source
  sourceFromString(s :String) :Source
  newContext() :Context
  initContext(context :Context) :\textbf{Ok}
  getGrammar(context :Context) :Grammar
  printGrammarEnv(context :Context) :\textbf{Ok}
  printGrammar(context :Context) :\textbf{Ok}
  getParser(context :Context) :Parser
  getEnvironment(context :Context) :Environment
  parse(context :Context src :Source) :Bindings
  typeCheck(context :Context bindings :Bindings) :SyntaxTree
  printSyntaxTree(context :Context syntaxTree :SyntaxTree) :\textbf{Ok}
  translate(context :Context syntaxTree :SyntaxTree) :TMLCode
  optimize(context :Context tmlCode :TMLCode) :TMLCode
  printTMLCode(context :Context tmlCode :TMLCode) :\textbf{Ok}
  generateCode(context :Context tmlCode :TMLCode) :TVMCode
  execute(context :Context tvmCode :TVMCode) :Result
  printResult(context :Context result :Result) :\textbf{Ok}
  printResultValue(context :Context result :Result) :\textbf{Ok}
  printLog(context :Context) :\textbf{Ok}
  printLogClear(context :Context) :\textbf{Ok}
  clearLog(context :Context) :\textbf{Ok}
end;
\end{alltt}