diff --git a/generator/main.ml b/generator/main.ml
index 328b0c7a5e3429fe2fc16ec487650262a8d52caa..dc289102749c5d0a8c3d550688c8fc3e1bb3ee04 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -44,6 +44,8 @@ let _ =
      | Some f -> f
    in
 
+   Printf.printf "sf: %s\n" sourcefile;
+
    (*---------------------------------------------------*)
    (* "reading and typing source file" *)
    let (opt, inputfile) = process_implementation_file ppf sourcefile in
@@ -55,5 +57,3 @@ let _ =
 
       let (logged, unlogged, pre) = Js_of_ast.to_javascript typedtree1 in
       file_put_contents outputfile unlogged
-      
-                                    
diff --git a/generator/stdlib_js/stdlib.js b/generator/stdlib_js/stdlib.js
index adbab39e9e5756d37808a9ee3e1325c1ce954c54..c59d8e5fd5c4832aa7b4f518f8ee04386ee2147b 100644
--- a/generator/stdlib_js/stdlib.js
+++ b/generator/stdlib_js/stdlib.js
@@ -12,6 +12,8 @@ var geq = function (a, b) { return a >= b }
 
 var print = function (x) { console.log(x) }
 
+var stuck = function (msg) { throw {type:'stuck', msg:msg} }
+
 var to_string = function (x) { return String(x) }
 
 var parse = function (source) {
diff --git a/generator/stdlib_ml/stdlib.mli b/generator/stdlib_ml/stdlib.mli
index 4a65911fbd2c4facf00a0d840c7c0717a0f1d78e..9298fa4dbf4fa40a9a6c6a371f84a3a8f7fb99d1 100644
--- a/generator/stdlib_ml/stdlib.mli
+++ b/generator/stdlib_ml/stdlib.mli
@@ -21,5 +21,6 @@ val ( >= ) : 'a -> 'a -> 'a
 
 val print : 'a -> unit
 
+val stuck : string -> 'a 
 val to_string : 'a -> string
 val parse : 'a -> 'b
diff --git a/generator/tests/calc.js b/generator/tests/calc.js
new file mode 100644
index 0000000000000000000000000000000000000000..a3ab6160500aa2cef3abbd07b14d77482c6fd8b0
--- /dev/null
+++ b/generator/tests/calc.js
@@ -0,0 +1,37 @@
+var eval_ = function (expr) {
+  return function () {
+  switch (expr.type) {
+    case "Const": var n = expr.value;
+                    return n;
+     case "Add": var ls = expr.left, rs = expr.right;
+                   return eval_(ls) + eval_(rs);
+      case "Sub": var ls = expr.left, rs = expr.right;
+                    return eval_(ls) - eval_(rs);
+       case "Mul": var ls = expr.left, rs = expr.right;
+                     return eval_(ls) * eval_(rs);
+        case "Div": var ls = expr.left, rs = expr.right;
+                      return eval_(ls) / eval_(rs);
+  }
+  }();
+};
+var print_expr = function (expr) {
+    return function () {
+    switch (expr.type) {
+      case "Const": var n = expr.value;
+                      return to_string(n);
+       case "Add": var ls = expr.left, rs = expr.right;
+                     return "(" + print_expr(ls) + ")" + " + " + print_expr(rs);
+        case "Sub": var ls = expr.left, rs = expr.right;
+                      return "(" + print_expr(ls) + ")" + " - " + print_expr(rs);
+         case "Mul": var ls = expr.left, rs = expr.right;
+                       return "(" + print_expr(ls) + ")" + " * " + print_expr(rs);
+          case "Div": var ls = expr.left, rs = expr.right;
+                        return "(" + print_expr(ls) + ")" + " / " + print_expr(rs);
+    }
+    }();
+  };
+var f = function () {
+    var source = parse("((1972 / 29) / 2) + 8");
+    return print(print_expr(source) + " = " + to_string(eval_(source)));
+    }();
+    
\ No newline at end of file