ligo/src/main/compile/of_source.ml

17 lines
664 B
OCaml
Raw Normal View History

2019-09-10 17:19:15 +04:00
open Trace
2019-09-11 15:56:39 +04:00
open Helpers
2019-11-30 01:22:56 +04:00
let compile (source_filename:string) syntax : Ast_simplified.program result =
2019-09-11 15:56:39 +04:00
let%bind syntax = syntax_to_variant syntax (Some source_filename) in
let%bind simplified = parsify syntax source_filename in
ok simplified
2019-11-30 01:22:56 +04:00
let compile_expression : v_syntax -> string -> Ast_simplified.expression result =
fun syntax exp ->
parsify_expression syntax exp
2019-09-11 15:56:39 +04:00
2019-11-30 01:22:56 +04:00
let compile_contract_input : string -> string -> v_syntax -> Ast_simplified.expression result =
fun storage parameter syntax ->
let%bind (storage,parameter) = bind_map_pair (compile_expression syntax) (storage,parameter) in
ok @@ Ast_simplified.e_pair storage parameter