diff --git a/regression/test034.expr b/regression/test034.expr index de21748fa..dd898077e 100644 --- a/regression/test034.expr +++ b/regression/test034.expr @@ -14,5 +14,6 @@ for i:=0, i (st, i, o, Some (Value.of_int (match List.hd args with Value.Array a -> List.length a | Value.String s -> String.length s))) | "$array" -> (st, i, o, Some (Value.of_array args)) - | s -> failwith (Printf.sprintf "Wow: %s\n" s) - + | "strcat" -> let [x; y] = args in + (st, i, o, Some (Value.of_string @@ Value.to_string x ^ Value.to_string y)) + | "isArray" -> let [a] = args in + (st, i, o, Some (Value.of_int @@ match a with Array _ -> 1 | _ -> 0)) + end (* Simple expressions: syntax and semantics *) diff --git a/src/SM.ml b/src/SM.ml index cd6e7a357..6ebf68b6a 100644 --- a/src/SM.ml +++ b/src/SM.ml @@ -6,8 +6,6 @@ open Language (* binary operator *) | BINOP of string (* put a constant on the stack *) | CONST of int (* put a string on the stack *) | STRING of string -(* read to stack *) | READ -(* write from stack *) | WRITE (* load a variable to the stack *) | LD of string (* store a variable from the stack *) | ST of string (* store in an array *) | STA of string * int