progs/token.scala
changeset 617 f7de0915fff2
parent 581 19de761b69e9
child 624 8d0af38389bc
--- a/progs/token.scala	Tue Dec 04 00:33:26 2018 +0000
+++ b/progs/token.scala	Sat Dec 29 10:30:27 2018 +0000
@@ -291,3 +291,19 @@
 }
 
 
+val fib = """
+write "Fib";
+read n;
+minus1 := 0;
+minus2 := 1;
+while n > 0 do {
+temp := minus2;
+minus2 := minus1 + minus2;
+minus1 := temp;
+n := n - 1
+};
+write "Result";
+write minus2
+"""
+
+println(env(lexing_simp(WHILE_REGS, prog2)).filterNot{_._1 == "w"})