Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lltz michelson): tests added #26

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
);
in {
packages.default = opamPackages.lltz;
packages.zarith = opamPackages.zarith;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be merged (added for debugging purposes)


devShells.default = pkgs.mkShell {
name = "lltz-shell";
Expand Down
138 changes: 69 additions & 69 deletions lib/lltz_ir/dsl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,32 @@ let signature_ty ?(range = dummy) () = LLTZ.T.{ desc = Signature; range }

(* Expressions *)
let variable ?(range = dummy) var = create ~range (LLTZ.E.Variable var)
let let_in ?(range = dummy) (var, rhs, in_) = create ~range (LLTZ.E.Let_in { let_var = var; rhs; in_ })
let lambda ?(range = dummy) (var, return_type, body) = create ~range (LLTZ.E.Lambda { lam_var = var; return_type; body })
let lambda_rec ?(range = dummy) (var, mu, return_type, body) = create ~range (LLTZ.E.Lambda_rec { lam_var = var; mu_var = mu; return_type; body })
let app ?(range = dummy) (abs, arg) = create ~range (LLTZ.E.App { abs; arg })
let let_mut_in ?(range = dummy) (var, rhs, in_) = create ~range (LLTZ.E.Let_mut_in { let_var = var; rhs; in_ })
let let_in ?(range = dummy) var ~rhs ~in_ = create ~range (LLTZ.E.Let_in { let_var = var; rhs; in_ })
let lambda ?(range = dummy) var ~return_type ~body = create ~range (LLTZ.E.Lambda { lam_var = var; return_type; body })
let lambda_rec ?(range = dummy) var ~mu ~return_type ~body = create ~range (LLTZ.E.Lambda_rec { lam_var = var; mu_var = mu; return_type; body })
let app ?(range = dummy) abs arg = create ~range (LLTZ.E.App { abs; arg })
let let_mut_in ?(range = dummy) var ~rhs ~in_ = create ~range (LLTZ.E.Let_mut_in { let_var = var; rhs; in_ })
let deref ?(range = dummy) var = create ~range (LLTZ.E.Deref var)
let assign ?(range = dummy) (var, value) = create ~range (LLTZ.E.Assign (var, value))
let if_bool ?(range = dummy) (condition, then_, else_) = create ~range (LLTZ.E.If_bool { condition; if_true = then_; if_false = else_ })
let if_none ?(range = dummy) (subject, none, some) = create ~range (LLTZ.E.If_none { subject; if_none = none; if_some = some })
let if_cons ?(range = dummy) (subject, empty, nonempty) = create ~range (LLTZ.E.If_cons { subject; if_empty = empty; if_nonempty = nonempty })
let if_left ?(range = dummy) (subject, left, right) = create ~range (LLTZ.E.If_left { subject; if_left = left; if_right = right })
let while_ ?(range = dummy) (invariant, body) = create ~range (LLTZ.E.While { invariant; body })
let while_left ?(range = dummy) (invariant, body) = create ~range (LLTZ.E.While_left { invariant; body })
let for_ ?(range = dummy) (index, init, invariant, variant, body) = create ~range (LLTZ.E.For { index; init; invariant; variant; body })
let for_each ?(range = dummy) (indices, collection, body) = create ~range (LLTZ.E.For_each { indices; collection; body })
let map ?(range = dummy) (collection, map) = create ~range (LLTZ.E.Map { collection; map })
let fold_left ?(range = dummy) (collection, init, fold) = create ~range (LLTZ.E.Fold_left { collection; init; fold })
let fold_right ?(range = dummy) (collection, init, fold) = create ~range (LLTZ.E.Fold_right { collection; init; fold })
let let_tuple_in ?(range = dummy) (components, rhs, in_) = create ~range (LLTZ.E.Let_tuple_in { components; rhs; in_ })
let assign ?(range = dummy) var value = create ~range (LLTZ.E.Assign (var, value))
let if_bool ?(range = dummy) condition ~then_ ~else_ = create ~range (LLTZ.E.If_bool { condition; if_true = then_; if_false = else_ })
let if_none ?(range = dummy) subject ~none ~some = create ~range (LLTZ.E.If_none { subject; if_none = none; if_some = some })
let if_cons ?(range = dummy) subject ~empty ~nonempty = create ~range (LLTZ.E.If_cons { subject; if_empty = empty; if_nonempty = nonempty })
let if_left ?(range = dummy) subject ~left ~right = create ~range (LLTZ.E.If_left { subject; if_left = left; if_right = right })
let while_ ?(range = dummy) invariant ~body = create ~range (LLTZ.E.While { invariant; body })
let while_left ?(range = dummy) invariant ~body = create ~range (LLTZ.E.While_left { invariant; body })
let for_ ?(range = dummy) index ~init ~invariant ~variant ~body = create ~range (LLTZ.E.For { index; init; invariant; variant; body })
let for_each ?(range = dummy) indices ~of_ ~body = create ~range (LLTZ.E.For_each { indices; collection=of_; body })
let map ?(range = dummy) collection ~map = create ~range (LLTZ.E.Map { collection; map })
let fold_left ?(range = dummy) collection ~init ~fold = create ~range (LLTZ.E.Fold_left { collection; init; fold })
let fold_right ?(range = dummy) collection ~init ~fold = create ~range (LLTZ.E.Fold_right { collection; init; fold })
let let_tuple_in ?(range = dummy) components ~rhs ~in_ = create ~range (LLTZ.E.Let_tuple_in { components; rhs; in_ })
let tuple ?(range = dummy) row = create ~range (LLTZ.E.Tuple row)
let proj ?(range = dummy) (tuple, path) = create ~range (LLTZ.E.Proj (tuple, path))
let update_tuple ?(range = dummy) (tuple, component, update) = create ~range (LLTZ.E.Update { tuple; component; update })
let inj ?(range = dummy) (path, expr) = create ~range (LLTZ.E.Inj (path, expr))
let match_ ?(range = dummy) (subject, cases) = create ~range (LLTZ.E.Match (subject, cases))
let proj ?(range = dummy) tuple ~path = create ~range (LLTZ.E.Proj (tuple, path))
let update_tuple ?(range = dummy) tuple ~component ~update = create ~range (LLTZ.E.Update { tuple; component; update })
let inj ?(range = dummy) path expr = create ~range (LLTZ.E.Inj (path, expr))
let match_ ?(range = dummy) subject ~cases = create ~range (LLTZ.E.Match (subject, cases))
let raw_michelson ?(range = dummy) node = create ~range (LLTZ.E.Raw_michelson node)
let create_contract ?(range = dummy) (storage, parameter, code, delegate, initial_balance, initial_storage) =
let create_contract ?(range = dummy) () ~storage ~parameter ~code ~delegate ~initial_balance ~initial_storage =
create ~range (LLTZ.E.Create_contract { storage; parameter; code; delegate; initial_balance; initial_storage })

(* Primitives *)
Expand All @@ -95,8 +95,8 @@ let self_address ?(range = dummy) () = create ~range (LLTZ.E.Prim (LLTZ.P.Self_a
let sender ?(range = dummy) () = create ~range (LLTZ.E.Prim (LLTZ.P.Sender, []))
let source ?(range = dummy) () = create ~range (LLTZ.E.Prim (LLTZ.P.Source, []))
let total_voting_power ?(range = dummy) () = create ~range (LLTZ.E.Prim (LLTZ.P.Total_voting_power, []))
let empty_bigmap ?(range = dummy) (key, value) = create ~range (LLTZ.E.Prim (LLTZ.P.Empty_bigmap (key, value), []))
let empty_map ?(range = dummy) (key, value) = create ~range (LLTZ.E.Prim (LLTZ.P.Empty_map (key, value), []))
let empty_bigmap ?(range = dummy) key value = create ~range (LLTZ.E.Prim (LLTZ.P.Empty_bigmap (key, value), []))
let empty_map ?(range = dummy) key value = create ~range (LLTZ.E.Prim (LLTZ.P.Empty_map (key, value), []))
let empty_set ?(range = dummy) ty = create ~range (LLTZ.E.Prim (LLTZ.P.Empty_set ty, []))
let nil ?(range = dummy) ty = create ~range (LLTZ.E.Prim (LLTZ.P.Nil ty, []))
let none ?(range = dummy) ty = create ~range (LLTZ.E.Prim (LLTZ.P.None ty, []))
Expand All @@ -109,25 +109,25 @@ let cdr ?(range = dummy) pair = create ~range (LLTZ.E.Prim (LLTZ.P.Cdr, [pair]))
let left ?(range = dummy) (opt1, opt2, ty) value = create ~range (LLTZ.E.Prim (LLTZ.P.Left (opt1, opt2, ty), [value]))
let right ?(range = dummy) (opt1, opt2, ty) value = create ~range (LLTZ.E.Prim (LLTZ.P.Right (opt1, opt2, ty), [value]))
let some ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Some, [value]))
let eq ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Eq, [lhs; rhs]))
let eq ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Eq, [lhs; rhs]))
let abs ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Abs, [value]))
let neg ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Neg, [value]))
let nat_prim ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Nat, [value]))
let int_prim ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Int, [value]))
let bytes_prim ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Bytes, [value]))
let is_nat ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Is_nat, [value]))
let neq ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Neq, [lhs; rhs]))
let le ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Le, [lhs; rhs]))
let lt ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Lt, [lhs; rhs]))
let ge ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Ge, [lhs; rhs]))
let gt ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Gt, [lhs; rhs]))
let neq ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Neq, [lhs; rhs]))
let le ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Le, [lhs; rhs]))
let lt ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Lt, [lhs; rhs]))
let ge ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Ge, [lhs; rhs]))
let gt ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Gt, [lhs; rhs]))
let not ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Not, [value]))
let size ?(range = dummy) container = create ~range (LLTZ.E.Prim (LLTZ.P.Size, [container]))
let address ?(range = dummy) contract = create ~range (LLTZ.E.Prim (LLTZ.P.Address, [contract]))
let implicit_account ?(range = dummy) key_hash = create ~range (LLTZ.E.Prim (LLTZ.P.Implicit_account, [key_hash]))
let contract ?(range = dummy) (opt, ty, address) = create ~range (LLTZ.E.Prim (LLTZ.P.Contract (opt, ty), [address]))
let contract ?(range = dummy) (opt, ty) address = create ~range (LLTZ.E.Prim (LLTZ.P.Contract (opt, ty), [address]))
let pack ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Pack, [value]))
let unpack ?(range = dummy) (ty,value) = create ~range (LLTZ.E.Prim (LLTZ.P.Unpack ty, [value]))
let unpack ?(range = dummy) ty value = create ~range (LLTZ.E.Prim (LLTZ.P.Unpack ty, [value]))
let hash_key ?(range = dummy) key = create ~range (LLTZ.E.Prim (LLTZ.P.Hash_key, [key]))
let blake2b ?(range = dummy) bytes = create ~range (LLTZ.E.Prim (LLTZ.P.Blake2b, [bytes]))
let sha256 ?(range = dummy) bytes = create ~range (LLTZ.E.Prim (LLTZ.P.Sha256, [bytes]))
Expand All @@ -136,48 +136,48 @@ let keccak ?(range = dummy) bytes = create ~range (LLTZ.E.Prim (LLTZ.P.Keccak, [
let sha3 ?(range = dummy) bytes = create ~range (LLTZ.E.Prim (LLTZ.P.Sha3, [bytes]))
let set_delegate ?(range = dummy) delegate = create ~range (LLTZ.E.Prim (LLTZ.P.Set_delegate, [delegate]))
let read_ticket ?(range = dummy) ticket = create ~range (LLTZ.E.Prim (LLTZ.P.Read_ticket, [ticket]))
let join_tickets ?(range = dummy) (ticket1, ticket2) = create ~range (LLTZ.E.Prim (LLTZ.P.Join_tickets, [ticket1; ticket2]))
let join_tickets ?(range = dummy) ticket1 ticket2 = create ~range (LLTZ.E.Prim (LLTZ.P.Join_tickets, [ticket1; ticket2]))
let pairing_check ?(range = dummy) pairings = create ~range (LLTZ.E.Prim (LLTZ.P.Pairing_check, [pairings]))
let voting_power ?(range = dummy) key_hash = create ~range (LLTZ.E.Prim (LLTZ.P.Voting_power, [key_hash]))
let getn ?(range = dummy) (n,value) = create ~range (LLTZ.E.Prim (LLTZ.P.Get_n n, [value]))
let cast ?(range = dummy) (ty,value) = create ~range (LLTZ.E.Prim (LLTZ.P.Cast ty, [value]))
let rename = assert false
let emit ?(range = dummy) (opt, ty, value) = create ~range (LLTZ.E.Prim (LLTZ.P.Emit (opt, ty), [value]))
let getn ?(range = dummy) n value = create ~range (LLTZ.E.Prim (LLTZ.P.Get_n n, [value]))
let cast ?(range = dummy) ty value = create ~range (LLTZ.E.Prim (LLTZ.P.Cast ty, [value]))
(*let rename = assert false*)
let emit ?(range = dummy) (opt, ty) value = create ~range (LLTZ.E.Prim (LLTZ.P.Emit (opt, ty), [value]))
let failwith ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Failwith, [value]))
let never ?(range = dummy) value = create ~range (LLTZ.E.Prim (LLTZ.P.Never, [value]))
let pair ?(range = dummy) (opt1, opt2, first, second) = create ~range (LLTZ.E.Prim (LLTZ.P.Pair (opt1, opt2), [first; second]))
let add ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Add, [lhs; rhs]))
let mul ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Mul, [lhs; rhs]))
let sub ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Sub, [lhs; rhs]))
let sub_mutez ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Sub_mutez, [lhs; rhs]))
let lsr_ ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Lsr, [lhs; rhs]))
let lsl_ ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Lsl, [lhs; rhs]))
let xor ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Xor, [lhs; rhs]))
let ediv ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Ediv, [lhs; rhs]))
let and_ ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.And, [lhs; rhs]))
let or_ ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Or, [lhs; rhs]))
let cons ?(range = dummy) (head, tail) = create ~range (LLTZ.E.Prim (LLTZ.P.Cons, [head; tail]))
let compare ?(range = dummy) (lhs, rhs) = create ~range (LLTZ.E.Prim (LLTZ.P.Compare, [lhs; rhs]))
let concat1 ?(range = dummy) (str1, str2) = create ~range (LLTZ.E.Prim (LLTZ.P.Concat1, [str1; str2]))
let concat2 ?(range = dummy) (bytes1, bytes2) = create ~range (LLTZ.E.Prim (LLTZ.P.Concat2, [bytes1; bytes2]))
let get ?(range = dummy) (key, collection) = create ~range (LLTZ.E.Prim (LLTZ.P.Get, [key; collection]))
let mem ?(range = dummy) (key, collection) = create ~range (LLTZ.E.Prim (LLTZ.P.Mem, [key; collection]))
let exec ?(range = dummy) (value, lambda) = create ~range (LLTZ.E.Prim (LLTZ.P.Exec, [value; lambda]))
let apply ?(range = dummy) (value, lambda) = create ~range (LLTZ.E.Prim (LLTZ.P.Apply, [value; lambda]))
let sapling_verify_update ?(range = dummy) (transaction, state) = create ~range (LLTZ.E.Prim (LLTZ.P.Sapling_verify_update, [transaction; state]))
let ticket ?(range = dummy) (content, amount) = create ~range (LLTZ.E.Prim (LLTZ.P.Ticket, [content; amount]))
let ticket_deprecated ?(range = dummy) (content, amount) = create ~range (LLTZ.E.Prim (LLTZ.P.Ticket_deprecated, [content; amount]))
let split_ticket ?(range = dummy) (ticket, amounts) = create ~range (LLTZ.E.Prim (LLTZ.P.Split_ticket, [ticket; amounts]))
let updaten ?(range = dummy) (n, value, pair) = create ~range (LLTZ.E.Prim (LLTZ.P.Update_n n, [value; pair]))
let view ?(range = dummy) (name, return_type, d, address) = create ~range (LLTZ.E.Prim (LLTZ.P.View (name, return_type), [d; address]))
let pair ?(range = dummy) (opt1, opt2) first second = create ~range (LLTZ.E.Prim (LLTZ.P.Pair (opt1, opt2), [first; second]))
let add ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Add, [lhs; rhs]))
let mul ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Mul, [lhs; rhs]))
let sub ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Sub, [lhs; rhs]))
let sub_mutez ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Sub_mutez, [lhs; rhs]))
let lsr_ ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Lsr, [lhs; rhs]))
let lsl_ ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Lsl, [lhs; rhs]))
let xor ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Xor, [lhs; rhs]))
let ediv ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Ediv, [lhs; rhs]))
let and_ ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.And, [lhs; rhs]))
let or_ ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Or, [lhs; rhs]))
let cons ?(range = dummy) head tail = create ~range (LLTZ.E.Prim (LLTZ.P.Cons, [head; tail]))
let compare ?(range = dummy) lhs rhs = create ~range (LLTZ.E.Prim (LLTZ.P.Compare, [lhs; rhs]))
let concat1 ?(range = dummy) str1 str2 = create ~range (LLTZ.E.Prim (LLTZ.P.Concat1, [str1; str2]))
let concat2 ?(range = dummy) bytes1 bytes2 = create ~range (LLTZ.E.Prim (LLTZ.P.Concat2, [bytes1; bytes2]))
let get ?(range = dummy) key collection = create ~range (LLTZ.E.Prim (LLTZ.P.Get, [key; collection]))
let mem ?(range = dummy) key collection = create ~range (LLTZ.E.Prim (LLTZ.P.Mem, [key; collection]))
let exec ?(range = dummy) value lambda = create ~range (LLTZ.E.Prim (LLTZ.P.Exec, [value; lambda]))
let apply ?(range = dummy) value lambda = create ~range (LLTZ.E.Prim (LLTZ.P.Apply, [value; lambda]))
let sapling_verify_update ?(range = dummy) transaction state = create ~range (LLTZ.E.Prim (LLTZ.P.Sapling_verify_update, [transaction; state]))
let ticket ?(range = dummy) content amount = create ~range (LLTZ.E.Prim (LLTZ.P.Ticket, [content; amount]))
let ticket_deprecated ?(range = dummy) content amount = create ~range (LLTZ.E.Prim (LLTZ.P.Ticket_deprecated, [content; amount]))
let split_ticket ?(range = dummy) ticket amounts = create ~range (LLTZ.E.Prim (LLTZ.P.Split_ticket, [ticket; amounts]))
let updaten ?(range = dummy) n value pair = create ~range (LLTZ.E.Prim (LLTZ.P.Update_n n, [value; pair]))
let view ?(range = dummy) name ~return_type ~d ~address = create ~range (LLTZ.E.Prim (LLTZ.P.View (name, return_type), [d; address]))

(* Arity 3 *)
let slice ?(range = dummy) (offset, length, sequence) = create ~range (LLTZ.E.Prim (LLTZ.P.Slice, [offset; length; sequence]))
let update ?(range = dummy) (key, value, collection) = create ~range (LLTZ.E.Prim (LLTZ.P.Update, [key; value; collection]))
let get_and_update ?(range = dummy) (key, value, collection) = create ~range (LLTZ.E.Prim (LLTZ.P.Get_and_update, [key; value; collection]))
let transfer_tokens ?(range = dummy) (param, amount, contract) = create ~range (LLTZ.E.Prim (LLTZ.P.Transfer_tokens, [param; amount; contract]))
let check_signature ?(range = dummy) (key, signature, message) = create ~range (LLTZ.E.Prim (LLTZ.P.Check_signature, [key; signature; message]))
let open_chest ?(range = dummy) (chest_key, chest, time) = create ~range (LLTZ.E.Prim (LLTZ.P.Open_chest, [chest_key; chest; time]))
let slice ?(range = dummy) offset ~length ~seq = create ~range (LLTZ.E.Prim (LLTZ.P.Slice, [offset; length; seq]))
let update ?(range = dummy) key value ~of_ = create ~range (LLTZ.E.Prim (LLTZ.P.Update, [key; value; of_]))
let get_and_update ?(range = dummy) key value ~of_ = create ~range (LLTZ.E.Prim (LLTZ.P.Get_and_update, [key; value; of_]))
let transfer_tokens ?(range = dummy) param ~amount ~contract = create ~range (LLTZ.E.Prim (LLTZ.P.Transfer_tokens, [param; amount; contract]))
let check_signature ?(range = dummy) key ~signature ~message = create ~range (LLTZ.E.Prim (LLTZ.P.Check_signature, [key; signature; message]))
let open_chest ?(range = dummy) chest_key ~chest ~time = create ~range (LLTZ.E.Prim (LLTZ.P.Open_chest, [chest_key; chest; time]))

let convert_list (exprs: LLTZ.E.t list) : LLTZ.E.t Row.t =
let converted_row_leaves = List.map (fun ty -> Row.Leaf (None, ty)) exprs in
Expand Down
1 change: 1 addition & 0 deletions lib/lltz_michelson/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(library
(name lltz_michelson)
(libraries michelson lltz_ir fmt)
(modules config instruction lltz_michelson ident slot stack type)
(inline_tests)
(preprocess
(pps ppx_jane))
Expand Down
7 changes: 6 additions & 1 deletion lib/lltz_michelson/lltz_michelson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Compiles types, constants, primitives and expressions from LLTZ-IR to Michelson Ast.
*)

module Stack = Stack
module Type = Type
module Instruction = Instruction
module Slot = Slot

open Core

module LLTZ = struct
Expand Down Expand Up @@ -539,4 +544,4 @@ and compile_matching cases =
]
| [] -> seq [])
| LLTZ.R.Leaf (_, ((var, var_type), return_type, body)) ->
seq [ compile (LLTZ.Dsl.lambda ((var, var_type), return_type, body)); exec ]
seq [ compile (LLTZ.Dsl.lambda (var, var_type) ~return_type ~body); exec ]
8 changes: 8 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(library
(name test_dsl)
(libraries core lltz_michelson fmt)
(modules test_dsl)
(inline_tests)
(preprocess (pps ppx_jane))
(flags (:standard -verbose -ccopt --verbose))
)
Loading