diff -r 155430aea517 -r 9e75249e96f2 handouts/ho08.tex --- a/handouts/ho08.tex Mon Nov 19 22:44:56 2018 +0000 +++ b/handouts/ho08.tex Mon Nov 19 23:21:32 2018 +0000 @@ -22,12 +22,12 @@ The language we looked at in the previous lecture was rather primitive and the compiler rather crude---everything was -essentially estimated into a big monolithic chunk of code +essentially compiled into a big monolithic chunk of code inside the main function. In this handout we like to have a look at a slightly more comfortable language, which I call Fun-language, and a tiny-teeny bit more realistic compiler. The Fun-language is a functional programming language. A small -collection of programs we want to be able to write and estimate +collection of programs we want to be able to write and compile is as follows: \begin{lstlisting}[numbers=none] @@ -49,7 +49,7 @@ more comfortable. We will still focus on programs involving integers only, that means for example that every function is expected to return an integer. The point of the Fun language -is to estimate each function to a separate method in JVM +is to compile each function to a separate method in JVM bytecode (not just a big monolithic code chunk). The means we need to adapt to some of the conventions of the JVM about methods. @@ -122,8 +122,8 @@ Let us first look at some clauses for compiling expressions. The compilation of arithmetic and boolean expressions is just -like for the While-language and do not need any modification. -(recall that the \textit{estimate}-function for boolean +like for the While-language and do not need any modification +(recall that the \textit{compile}-function for boolean expression takes a third argument for the label where the control-flow should jump when the boolean expression is \emph{not} true---this is needed for compiling \pcode{if}s). @@ -227,7 +227,7 @@ the Halting problem, and thus undecidable in general. Fortunately, we are only asked how much stack a \emph{single} call of the function requires. This can be relatively easily -estimated by recursively analysing which instructions we +compiled by recursively analysing which instructions we generate and how much stack they might require. \begin{center}