ligo/src/main/compile/of_source.ml

24 lines
896 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
2020-03-13 02:20:39 +04:00
let compile (source_filename:string) syntax : Ast_imperative.program result =
2019-09-11 15:56:39 +04:00
let%bind syntax = syntax_to_variant syntax (Some source_filename) in
2020-03-13 02:20:39 +04:00
let%bind abstract = parsify syntax source_filename in
ok abstract
2019-09-11 15:56:39 +04:00
2020-03-13 02:20:39 +04:00
let compile_string (source:string) syntax : Ast_imperative.program result =
let%bind abstract = parsify_string syntax source in
ok abstract
2019-12-23 18:18:32 +04:00
2020-03-13 02:20:39 +04:00
let compile_expression : v_syntax -> string -> Ast_imperative.expression result =
2019-11-30 01:22:56 +04:00
fun syntax exp ->
parsify_expression syntax exp
2019-09-11 15:56:39 +04:00
2020-03-13 02:20:39 +04:00
let compile_contract_input : string -> string -> v_syntax -> Ast_imperative.expression result =
2019-11-30 01:22:56 +04:00
fun storage parameter syntax ->
let%bind (storage,parameter) = bind_map_pair (compile_expression syntax) (storage,parameter) in
2020-03-13 02:20:39 +04:00
ok @@ Ast_imperative.e_pair storage parameter
let pretty_print source_filename syntax =
2020-03-13 02:20:39 +04:00
Helpers.pretty_print syntax source_filename