StringVal as a builtin .string

This commit is contained in:
Dmitry Boulytchev 2018-10-31 20:10:50 +03:00
parent 9caee0c526
commit 3cd95f8b5f
4 changed files with 160 additions and 26 deletions

View file

@ -183,6 +183,7 @@ let compile (defs, p) =
| Expr.Sexp (t, xs) -> List.flatten (List.map expr xs) @ [SEXP (t, List.length xs)]
| Expr.Elem (a, i) -> expr a @ expr i @ [CALL (".elem", 2, false)]
| Expr.Length e -> expr e @ [CALL (".length", 1, false)]
| Expr.StringVal e -> expr e @ [CALL (".stringval", 1, false)]
in
let rec compile_stmt l env = function
| Stmt.Assign (x, [], e) -> env, false, expr e @ [ST x]