Commit c097776b authored by Julien Lopez's avatar Julien Lopez

[TESTS][EVAL] Fix in abstraction and add some tests

parent fc7f9e8b
......@@ -45,7 +45,7 @@ let parse_to_lambda expr =
in
let new_env = mk_env ~parent:(Some env) ~max_size:env.max_size ~map:map
nbrparams (env.global_size + nbrparams) in
let brs = compile_func_body new_env body in
let brs = compile_func_body new_env body (nbrparams - 1) in
Abstraction(params, [], brs, nbrparams, true, List [[]])
| Var(loc, vname) ->
(try let index = env_find env vname in Var(Local(index))
......@@ -71,12 +71,13 @@ let parse_to_lambda expr =
_parse_to_lambda env e1)
(* TODO: Fix this function *)
and compile_func_body env body =
let dummy_state = { uid=0; arity=[||]; actions=AIgnore(0,[||],0);
and compile_func_body env body nbrparams =
let dummy_state = { uid=0; arity=[||]; actions=AIgnore(0,[|Catch|],0);
fail_code=0; expected_type="" } in
let body = _parse_to_lambda env body in
{ brs_accept_chars=true; brs_disp=dummy_state;
brs_rhs=[|Auto_pat.Match (0, body)|]; brs_stack_pos=env.global_size }
brs_rhs=[|Auto_pat.Match (nbrparams, body)|];
brs_stack_pos=env.global_size - nbrparams }
(* TODO: Fix this function *)
and compile_branches env brs =
......
......@@ -2,7 +2,8 @@
ROOT="."
BIN=$ROOT/`grep OUT $ROOT/Makefile | head -1 | cut -d '=' -f 2 | tr -d ' '`
MODULES="$ROOT/tests/lexer $ROOT/tests/parser $ROOT/tests/eval"
MODULES="$ROOT/tests/lexer $ROOT/tests/parser $ROOT/tests/letexpr\
$ROOT/tests/eval"
OUT=__out__
DIFF=__diff__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment