|
1 \documentclass{article} |
|
2 \usepackage{charter} |
|
3 \usepackage{hyperref} |
|
4 \usepackage{amssymb} |
|
5 \usepackage{amsmath} |
|
6 \usepackage{listings} |
|
7 \usepackage{xcolor} |
|
8 |
|
9 |
|
10 \newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% |
|
11 \begin{document} |
|
12 |
|
13 \definecolor{javared}{rgb}{0.6,0,0} % for strings |
|
14 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments |
|
15 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords |
|
16 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc |
|
17 |
|
18 \lstdefinelanguage{scala}{ |
|
19 morekeywords={abstract,case,catch,class,def,% |
|
20 do,else,extends,false,final,finally,% |
|
21 for,if,implicit,import,match,mixin,% |
|
22 new,null,object,override,package,% |
|
23 private,protected,requires,return,sealed,% |
|
24 super,this,throw,trait,true,try, |
|
25 type,val,var,while,with,yield}, |
|
26 otherkeywords={=>,<-,<\%,<:,>:,\#,@}, |
|
27 sensitive=true, |
|
28 morecomment=[l]{//}, |
|
29 morecomment=[n]{/*}{*/}, |
|
30 morestring=[b]", |
|
31 morestring=[b]', |
|
32 morestring=[b]""" |
|
33 } |
|
34 |
|
35 \lstdefinelanguage{while}{ |
|
36 morekeywords={while, if, then. else, read, write}, |
|
37 otherkeywords={=>,<-,<\%,<:,>:,\#,@}, |
|
38 sensitive=true, |
|
39 morecomment=[l]{//}, |
|
40 morecomment=[n]{/*}{*/}, |
|
41 morestring=[b]", |
|
42 morestring=[b]', |
|
43 morestring=[b]""" |
|
44 } |
|
45 |
|
46 |
|
47 \lstset{language=Scala, |
|
48 basicstyle=\ttfamily, |
|
49 keywordstyle=\color{javapurple}\bfseries, |
|
50 stringstyle=\color{javagreen}, |
|
51 commentstyle=\color{javagreen}, |
|
52 morecomment=[s][\color{javadocblue}]{/**}{*/}, |
|
53 numbers=left, |
|
54 numberstyle=\tiny\color{black}, |
|
55 stepnumber=1, |
|
56 numbersep=10pt, |
|
57 tabsize=2, |
|
58 showspaces=false, |
|
59 showstringspaces=false} |
|
60 |
|
61 |
|
62 |
|
63 \section*{Coursework 3} |
|
64 |
|
65 \noindent |
|
66 This coursework is worth 4\% and is due on 13 December at 16:00. You are asked to |
|
67 implement a compiler for the WHILE language. You are supposed to target the |
|
68 assembler language provided by the Jasmin for running on the Java Virtual Machine. |
|
69 |
|
70 |
|
71 \noindent |
|
72 You need to submit a document containing the answers for the questions |
|
73 below. You can do the implementation in any programming language you like, but you need |
|
74 to submit the source code with which you answered the questions. However, the coursework |
|
75 will \emph{only} be judged according to the answers. You can submit your answers |
|
76 in a txt-file or as pdf.\bigskip |
|
77 |
|
78 |
|
79 \subsection*{Question 1 (marked with 1\%)} |
|
80 |
|
81 |
|
82 |
|
83 \end{document} |
|
84 |
|
85 %%% Local Variables: |
|
86 %%% mode: latex |
|
87 %%% TeX-master: t |
|
88 %%% End: |