clean up
[cc1516.git] / deliverables / report / sem.tex
index 8ff63cc..9897c0a 100644 (file)
 %}     
 %\end{SPLCode}
 
-Every anonymous functions gets a unique name outside the namespace of legal
-names for functions making sure the name is unique. By implementing the
-transformation in the parsing phase the function is automatically checked
-or inferred on type.
-
 The semantic analysis phase asses if a -grammatically correct- program is also
 semantically correct and decorates the program with extra information it 
 finds during this checking. The input of the semantic analysis is an \AST{} of 
@@ -54,12 +49,12 @@ parsed program, its output is either a semantically correct and completely typed
 \AST{} plus the environment in which it was typed (for debug purposes), or it is 
 an error describing the problem with the \AST{}. 
 
-During this analysis \SPLC{} checks four properties of the program:
+During this analysis \SPLC{} applies one \AST{} transformation and checks four 
+properties of the program:
 \begin{enumerate}
        \item That no functions are declared with the same name
        \item That \tt{main} is of type \tt{(-> Void)}
        \item That the program includes a main function
-       \item AST transformation for lambdas
        \item That the program is correctly typed
 \end{enumerate}
 The first three steps are simple sanity checks which are coded in slightly over 
@@ -129,11 +124,8 @@ essence the program is typed as nested \tt{let .. in ..} statements.
 \subsubsection{Types}
 Listing~\ref{lst:types} shows the ADT representing types in \SPLC{}. Most of 
 these are self explanatory, however typing of functions requires some special
-attention. \SPLC{}s extension is higher order functions, this is described
-in more detail in Section~\ref{sec:ext}. These require a change to the
-type system, which we will already describe here.
-
-Higher order functions require that the type system can distinguish if an 
+attention. \SPLC{}s extension of higher order functions requires that the type 
+system can distinguish if an 
 expression represents a type $a$ or a functions which takes no input and returns
 a value of type $a$ (we write: $\rightarrow a$). The latter is represented by 
 the \CI{FuncType}. 
@@ -150,7 +142,7 @@ type then in itself can be a function.
 :: Type 
        = TupleType (Type, Type)        -- (t1, t2)
        | ListType type                         -- [t]
-       | IdType TVar                           -- polymorphic type
+       | IdType TVar                           -- type variable
        | IntType 
        | BoolType
        | CharType
@@ -305,7 +297,7 @@ a FieldHd = ListType a}
                }
                {\Gamma(\textit{id}) = \lfloor \tau_e \rfloor
                &\Gamma \vdash e \Rightarrow (\Gamma^{\star_1}, \star_1, \tau_g, e')
-               &\texttt{fold unapfs } \tau_g \textit{reverse fs} = \tau^r
+               &\texttt{fold unapfs } \tau_g \textit{ reverse fs} = \tau^r
                &\tau_e \unif \tau_g = \star_2
                &\star = \star_2 \cdot \star_1
                }