4 \usepackage{../graphics} |
4 \usepackage{../graphics} |
5 \usepackage{../langs} |
5 \usepackage{../langs} |
6 |
6 |
7 \begin{document} |
7 \begin{document} |
8 |
8 |
9 \section*{Coursework 5\footnote{\today}} |
9 \section*{Coursework 5} |
10 |
10 |
11 |
11 |
12 |
12 |
13 \noindent This coursework is worth 12\% and is due on \cwFIVE{} at |
13 \noindent This coursework is worth 25\% and is due on \cwFIVE{} at |
14 18:00. You are asked to implement a compiler targeting the LLVM-IR. |
14 18:00. You are asked to implement a compiler targeting the LLVM-IR. |
15 Be careful that this CW needs some material about the LLVM-IR |
15 Be careful that this CW needs some material about the LLVM-IR |
16 that has not been shown in the lectures and your own experiments |
16 that has not been shown in the lectures and your own experiments |
17 might be required. You can find information about the LLVM-IR at |
17 might be required. You can find information about the LLVM-IR at |
18 |
18 |
25 You can do the implementation of your compiler in any programming |
25 You can do the implementation of your compiler in any programming |
26 language you like, but you need to submit the source code with which |
26 language you like, but you need to submit the source code with which |
27 you generated the LLVM-IR files, otherwise a mark of 0\% will be |
27 you generated the LLVM-IR files, otherwise a mark of 0\% will be |
28 awarded. You should use the lexer and parser from the previous |
28 awarded. You should use the lexer and parser from the previous |
29 courseworks, but you need to make some modifications to them for the |
29 courseworks, but you need to make some modifications to them for the |
30 `typed' fun-language. I will award up to 4\% if a lexer and parser are |
30 `typed' fun-language. I will award up to 5\% if a lexer and a parser are |
31 implemented. At the end, please package everything(!) in a zip-file |
31 correctly implemented. At the end, please package everything(!) in a zip-file |
32 that creates a directory with the name \texttt{YournameYourFamilyname} |
32 that creates a directory with the name \texttt{YournameYourFamilyname} |
33 on my end. |
33 on my end. |
34 |
34 |
35 \subsection*{Disclaimer\alert} |
35 \subsection*{Disclaimer\alert} |
36 |
36 |
212 and so on receives. Once the types are inferred, the |
212 and so on receives. Once the types are inferred, the |
213 LLVM-IR code can be generated. Since we are dealing only |
213 LLVM-IR code can be generated. Since we are dealing only |
214 with simple first-order functions, nothing on the scale |
214 with simple first-order functions, nothing on the scale |
215 as the `Hindley-Milner' typing-algorithm is needed. I suggest |
215 as the `Hindley-Milner' typing-algorithm is needed. I suggest |
216 to just look at what data is avaliable and generate all |
216 to just look at what data is avaliable and generate all |
217 missing information by simple means. |
217 missing information by ``simple means''\ldots rather than |
|
218 looking at the literature which solves the problem |
|
219 with much heavier machinery. |
218 |
220 |
219 \item \textbf{Build-In Functions}: The `prelude' comes |
221 \item \textbf{Build-In Functions}: The `prelude' comes |
220 with several build-in functions: \texttt{new\_line()}, |
222 with several build-in functions: \texttt{new\_line()}, |
221 \texttt{skip}, \texttt{print\_int(n)}, \texttt{print\_space()} |
223 \texttt{skip}, \texttt{print\_int(n)}, \texttt{print\_space()} |
222 and \texttt{print\_star()}. You can find the `prelude' for |
224 and \texttt{print\_star()}. You can find the `prelude' for |