Builds (commented out a few issues, just to check that there are no compilation errors left)

This commit is contained in:
Suzanne Dupéron 2019-10-10 03:55:08 -04:00
parent acfbd7eb15
commit 581babb459
4 changed files with 35 additions and 29 deletions

View File

@ -139,17 +139,18 @@ let run_function =
(term , Term.info ~docs cmdname) (term , Term.info ~docs cmdname)
let evaluate_value = let evaluate_value =
let f source entry_point amount syntax display_format = failwith "TODO"
toplevel ~display_format @@ (* let f source entry_point amount syntax display_format =
let%bind output = * toplevel ~display_format @@
Ligo.Run.Of_source.evaluate_entry ~amount source entry_point (Syntax_name syntax) in * let%bind output =
ok @@ Format.asprintf "%a\n" Ast_simplified.PP.expression output * Ligo.Run.Of_source.evaluate_entry ~amount source entry_point (Syntax_name syntax) in
in * ok @@ Format.asprintf "%a\n" Ast_simplified.PP.expression output
let term = * in
Term.(const f $ source 0 $ entry_point 1 $ amount $ syntax $ display_format) in * let term =
let cmdname = "evaluate-value" in * Term.(const f $ source 0 $ entry_point 1 $ amount $ syntax $ display_format) in
let docs = "Subcommand: evaluate a given definition." in * let cmdname = "evaluate-value" in
(term , Term.info ~docs cmdname) * let docs = "Subcommand: evaluate a given definition." in
* (term , Term.info ~docs cmdname) *)
let compile_expression = let compile_expression =
let f expression syntax display_format = let f expression syntax display_format =

View File

@ -3,23 +3,25 @@ open Trace
open Tezos_utils open Tezos_utils
let compile_contract_entry (program : program) entry_point = let compile_contract_entry (program : program) entry_point =
let%bind prog_typed = Typer.type_program program in let%bind (_ , _ , prog_typed) = Typer.type_program program in
Of_typed.compile_contract_entry prog_typed entry_point Of_typed.compile_contract_entry prog_typed entry_point
let compile_function_entry (program : program) entry_point : _ result = let compile_function_entry (program : program) entry_point : _ result =
let%bind prog_typed = Typer.type_program program in let%bind (_ , _ , prog_typed) = Typer.type_program program in
Of_typed.compile_function_entry prog_typed entry_point Of_typed.compile_function_entry prog_typed entry_point
let compile_expression_as_function_entry (program : program) entry_point : _ result = let compile_expression_as_function_entry (program : program) entry_point : _ result =
let%bind typed_program = Typer.type_program program in let%bind (_,_,typed_program) = Typer.type_program program in
Of_typed.compile_expression_as_function_entry typed_program entry_point Of_typed.compile_expression_as_function_entry typed_program entry_point
let compile_expression_as_value ?(env = Ast_typed.Environment.full_empty) ae : Michelson.t result = let compile_expression_as_value ?(env = Ast_typed.Environment.full_empty) ae : Michelson.t result =
let%bind typed = Typer.type_expression env ae in let todo_state = failwith "todo" in
let%bind (typed , _) = Typer.type_expression env todo_state ae in
Of_typed.compile_expression_as_value typed Of_typed.compile_expression_as_value typed
let compile_expression_as_function ?(env = Ast_typed.Environment.full_empty) ae : _ result = let compile_expression_as_function ?(env = Ast_typed.Environment.full_empty) ae : _ result =
let%bind typed = Typer.type_expression env ae in let todo_state = failwith "todo" in
let%bind (typed , _) = Typer.type_expression env todo_state ae in
Of_typed.compile_expression_as_function typed Of_typed.compile_expression_as_function typed
let uncompile_typed_program_entry_expression_result program entry ex_ty_value = let uncompile_typed_program_entry_expression_result program entry ex_ty_value =

View File

@ -25,15 +25,17 @@ let compile_expression_as_function : string -> s_syntax -> _ result =
let type_file ?(debug_simplify = false) ?(debug_typed = false) let type_file ?(debug_simplify = false) ?(debug_typed = false)
syntax (source_filename:string) : Ast_typed.program result = syntax (source_filename:string) : Ast_typed.program result =
let%bind syntax = syntax_to_variant syntax (Some source_filename) in let _ = debug_simplify, debug_typed, syntax, source_filename in
let%bind simpl = parsify syntax source_filename in failwith "TODO"
(if debug_simplify then (* let%bind syntax = syntax_to_variant syntax (Some source_filename) in
Format.(printf "Simplified : %a\n%!" Ast_simplified.PP.program simpl) * let%bind simpl = parsify syntax source_filename in
) ; * (if debug_simplify then
let%bind typed = * Format.(printf "Simplified : %a\n%!" Ast_simplified.PP.program simpl)
trace (simple_error "typing") @@ * ) ;
Typer.type_program simpl in * let%bind typed =
(if debug_typed then ( * trace (simple_error "typing") @@
Format.(printf "Typed : %a\n%!" Ast_typed.PP.program typed) * Typer.type_program simpl in
)) ; * (if debug_typed then (
ok typed * Format.(printf "Typed : %a\n%!" Ast_typed.PP.program typed)
* )) ;
* ok typed *)

View File

@ -873,8 +873,9 @@ and type_expression : environment -> Solver.state -> I.expression -> (O.annotate
let%bind (result , state') = type_expression e' state result in let%bind (result , state') = type_expression e' state result in
let output_type = result.type_annotation in let output_type = result.type_annotation in
let wrapped = Wrap.lambda fresh input_type' output_type' in let wrapped = Wrap.lambda fresh input_type' output_type' in
let _TODO = output_type in
return_wrapped return_wrapped
(E_lambda {binder = fst binder; input_type=fresh;output_type; body=result}) (E_lambda {binder = fst binder;(* input_type=fresh;output_type; *)body=result})
state' wrapped state' wrapped
) )