updated
authorChristian Urban <urbanc@in.tum.de>
Fri, 24 Jan 2020 20:51:19 +0000
changeset 706 b560f78781b9
parent 705 bfc8703b1527
child 707 2fcd7c2da729
updated
coursework/cw04.tex
handouts/ho01.tex
progs/hanoi.fun
--- a/coursework/cw04.tex	Sat Dec 14 17:57:43 2019 +0000
+++ b/coursework/cw04.tex	Fri Jan 24 20:51:19 2020 +0000
@@ -8,6 +8,9 @@
 %https://github.com/Storyyeller/Krakatau
 %https://docs.oracle.com/javase/specs/jvms/se7/html/
 
+% Jasmin Tutorial
+%http://saksagan.ceng.metu.edu.tr/courses/ceng444/link/jvm-cpm.html
+
 \section*{Coursework 4 (Strand 1)}
 
 \noindent This coursework is worth 6\% and is due on 13
@@ -383,7 +386,7 @@
       invokevirtual java/io/InputStream/read()I 
       istore 2 
       iload 2 
-      ldc 10   ; the newline delimiter 
+      ldc 10  ; the newline delimiter for Unix (Windows 13)
       isub 
       ifeq Label2 
       iload 2 
--- a/handouts/ho01.tex	Sat Dec 14 17:57:43 2019 +0000
+++ b/handouts/ho01.tex	Fri Jan 24 20:51:19 2020 +0000
@@ -85,6 +85,10 @@
 %You might also be surprised what
 %constraints programming languages impose about numbers: for example
 %123 in JSON is OK, but 0123 is not.
+%
+% The regex for JASON numbers is
+%
+% -?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?
 
 Often we also face the problem that we are given a string, for example
 some user input, and we want to know whether it matches a particular
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/progs/hanoi.fun	Fri Jan 24 20:51:19 2020 +0000
@@ -0,0 +1,10 @@
+// towers of hanoi in Fun
+
+let rec hanoi = fun n a b c ->
+  if n != 0 then (
+    hanoi (n - 1) a c b;
+    print_endline ("Move disk from pole " ^ (show a) ^ " to pole " ^ (show b));
+    hanoi (n - 1) c b a
+  ) else ();;
+
+impure $ hanoi 4 1 2 3;;
\ No newline at end of file