@@ -369,7 +369,9 @@ The type of the expression given to the return statement must match the return t
Once the return statement is executed, the function is immediately exited.
\paragraph{Exit Statements:}
\hl{... ??? ...}
\hl{An exit statement }\lit{exit}\hl{ is used terminate the execution of the running program with a particular exit code. The statement is given an expression that must evaluate to a value with type }\lit{int}\hl{ (with 0 and 1 typically denoting success and failure respectively).}
\hl{Upon encountering an exit statement, a program will terminate immediately after the given expression has been successfully evaluated; any code thereafter will be ignored. }
\fillgap{\hl{define exit statements}}{2 marks}
\paragraph{Print Statements:}
...
...
@@ -394,18 +396,18 @@ The behaviour of the print statements for each type of expression is shown in Ta
\hline
\lit*{char}& Output a single-character string. &\lit*{\textquotesingle c\textquotesingle}& ``c'' \\
\hline
\lit*{string} or \lit*{char[]}&\hl{Output the character array converted into a single string.}&\lit*{\hl{['h','e','y','!']}}&\hl{``hey!''}\\
\lit*{string} or \lit*{char[]}&\hl{Output the character array converted into a single string.}&\lit*{\hl{[`h',`e',`y', `!']}}&\hl{``hey!''}\\
\hline
Other Array Types &\hl{Output the address of the array.}&\hl{[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}&\hl{``\#addrs\#''}\\
Other Array Types &\hl{Output the address of the array.}&\lit*{\hl{[5, 6, 8]}}\hl{located at 0x22150}&\hl{``0x22150''}\\
\hline
\lit*{pair}&\hl{Output the address of the pair if it is not null. Else, (null) will be printed.}&\lit*{newpair(a, b)}\footnotemark[1]&\hl{``\#addrs\#''}\\
\lit*{pair}&\hl{Output the address of the pair if it is not null; otherwise, ``(null)'' will be printed.}&\lit*{\hl{newpair(a, b)}}\footnotemark[1]\hl{located at 0x23940}&\hl{``0x23940''}\\
\hline
\end{tabulary}
\caption{The behaviour of the print statements for each type of expression.}
\label{tab:print}
\end{table}
\footnotetext[1]{This is not exactly an expression because it can only appear on the right hand side of an assignment. However, it gives the best example here.}
\footnotetext[1]{This is not an expression, strictly speaking, since it can only appear on the right hand side of an assignment. As such, \lit{newpair} statements cannot be printed directly, although the principle is correct in this example.}
\paragraph{Conditional Branch Statements:}
A conditional branch statement \lit{if} evaluates an expression and determines which program path to follow.
...
...
@@ -464,7 +466,7 @@ A character literal \synt{char-liter} is a single ASCII character between two \l
A \lit{\char`\\} can be used to escape the character that immediately follows the \lit{\char`\\}.
The meaning of each escaped character is shown in Table~\ref{tab:escapedcharacters}.
\fillgap{\hl{Fill in Table}~\ref{tab:escapedcharacters}}{2 marks}
%
%TODO:highlight \b \t \n \f
\begin{table}
\centering
\begin{tabular}{cclc}
...
...
@@ -472,10 +474,10 @@ The meaning of each escaped character is shown in Table~\ref{tab:escapedcharacte
Representation & ASCII Value & Description & Symbol \\