9 \subtitle{\texttt{<splc>~::= <spl> <parser> `,' <lexer> `and' <compiler>
}}
10 \author[P. Jager, M. Lubbers
]{Pim Jager
\inst{1}\and Mart Lubbers
\inst{1}}
11 \institute[Radboud University
]{%
13 Computer Science: Software Science\\
16 \subject{SPL Compiler
}
20 basicstyle=
\ttfamily\footnotesize,
25 \usecolortheme{beaver
}
30 \begin{frame
}[fragile
]
31 \frametitle{Higher order functions implemented using function pointers
}
34 map(f, xs) :: (a -> b) ->
[a
] ->
[b
] {
35 if( isEmpty(xs) )
{ return
[];
}
36 else
{ return f(xs.hd) : map(f, xs.tl);
}
46 \item Function arguments are passed by name.
47 \item During compilation these are replaced by unique function ID's
48 \item During runtime the corresponding function label is retrieved using
49 a dictionary like approach.
54 \begin{frame
}[fragile
]
55 \frametitle{Functions application can be curried
}
58 plus(x,y) :: Int -> Int -> Int
{
63 map(plus(
1),
1:
2:
3:
[]);
68 \begin{column
}[T
]{0.5\textwidth}
70 \item Function ID is placed on the heap
71 \item Number of passed arguments is placed on the heap
72 \item Arguments are pushed on the heap
76 \begin{column
}[T
]{0.5\textwidth}
77 \begin{block
}{Heap contents
}
78 \begin{tabular
}{c | l | r
}
79 address & Content & \\
\hline