MR requests
This commit is contained in:
parent
df0dfb029b
commit
c62f147a01
@ -5,9 +5,11 @@ let compile (program : Ast_simplified.program) : (Ast_typed.program * Typer.Solv
|
||||
let () = Typer.Solver.discard_state state in
|
||||
ok @@ (prog_typed, state)
|
||||
|
||||
(* let apply (program : Ast_simplified.program) (entry_point : string) (param : Ast_simplified.expression) : Ast_simplified.expression result = *)
|
||||
let compile_expression ?(env = Ast_typed.Environment.full_empty) ~(state : Typer.Solver.state) (ae : Ast_simplified.expression)
|
||||
: (Ast_typed.value * Typer.Solver.state) result =
|
||||
Typer.type_expression env state ae
|
||||
|
||||
let apply (entry_point : string) (param : Ast_simplified.expression) : Ast_simplified.expression result =
|
||||
(* let%bind (exp,_) = Ast_simplified.Misc.get_entry program entry_point in *)
|
||||
let name = Var.of_name entry_point in
|
||||
let entry_point_var : Ast_simplified.expression =
|
||||
{ expression = Ast_simplified.E_variable name ;
|
||||
@ -16,6 +18,3 @@ let apply (entry_point : string) (param : Ast_simplified.expression) : Ast_simpl
|
||||
{ expression = Ast_simplified.E_application (entry_point_var, param) ;
|
||||
location = Virtual "generated application" } in
|
||||
ok applied
|
||||
|
||||
let compile_expression ?(env = Ast_typed.Environment.full_empty) ~(state : Typer.Solver.state) (ae : Ast_simplified.expression) : (Ast_typed.value * Typer.Solver.state) result =
|
||||
Typer.type_expression env state ae
|
@ -157,13 +157,9 @@ let aggregate_entry (lst : program) (form : form_t) : expression result =
|
||||
match (entry_expression.content) with
|
||||
| (E_closure l) -> (
|
||||
let l' = { l with body = wrapper l.body } in
|
||||
let%bind t' =
|
||||
let%bind (input_ty , output_ty) = get_t_function entry_expression.type_value in
|
||||
ok (t_function input_ty output_ty)
|
||||
in
|
||||
let e' = {
|
||||
content = E_closure l' ;
|
||||
type_value = t' ;
|
||||
type_value = entry_expression.type_value ;
|
||||
} in
|
||||
ok e'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user