I removed dummy module [MBytes] an use [Hex] directly.
This commit is contained in:
parent
495686bbd4
commit
aa117ecfc2
6
AST.ml
6
AST.ml
@ -453,7 +453,7 @@ and expr =
|
||||
| MapExpr of map_expr
|
||||
| Var of Lexer.lexeme reg
|
||||
| FunCall of fun_call
|
||||
| Bytes of (Lexer.lexeme * MBytes.t) reg
|
||||
| Bytes of (Lexer.lexeme * Hex.t) reg
|
||||
| Unit of c_Unit
|
||||
| Tuple of tuple
|
||||
| ParExpr of expr par reg
|
||||
@ -590,7 +590,7 @@ and pattern =
|
||||
| PVar of Lexer.lexeme reg
|
||||
| PWild of wild
|
||||
| PInt of (Lexer.lexeme * Z.t) reg
|
||||
| PBytes of (Lexer.lexeme * MBytes.t) reg
|
||||
| PBytes of (Lexer.lexeme * Hex.t) reg
|
||||
| PString of Lexer.lexeme reg
|
||||
| PUnit of c_Unit
|
||||
| PFalse of c_False
|
||||
@ -773,7 +773,7 @@ let print_string {region; value=lexeme} =
|
||||
let print_bytes {region; value = lexeme, abstract} =
|
||||
printf "%s: Bytes (\"%s\", \"0x%s\")\n"
|
||||
(compact region) lexeme
|
||||
(MBytes.to_hex abstract |> Hex.to_string)
|
||||
(Hex.to_string abstract)
|
||||
|
||||
let print_int {region; value = lexeme, abstract} =
|
||||
printf "%s: Int (\"%s\", %s)\n"
|
||||
|
4
AST.mli
4
AST.mli
@ -437,7 +437,7 @@ and expr =
|
||||
| MapExpr of map_expr
|
||||
| Var of Lexer.lexeme reg
|
||||
| FunCall of fun_call
|
||||
| Bytes of (Lexer.lexeme * MBytes.t) reg
|
||||
| Bytes of (Lexer.lexeme * Hex.t) reg
|
||||
| Unit of c_Unit
|
||||
| Tuple of tuple
|
||||
| ParExpr of expr par reg
|
||||
@ -574,7 +574,7 @@ and pattern =
|
||||
| PVar of Lexer.lexeme reg
|
||||
| PWild of wild
|
||||
| PInt of (Lexer.lexeme * Z.t) reg
|
||||
| PBytes of (Lexer.lexeme * MBytes.t) reg
|
||||
| PBytes of (Lexer.lexeme * Hex.t) reg
|
||||
| PString of Lexer.lexeme reg
|
||||
| PUnit of c_Unit
|
||||
| PFalse of c_False
|
||||
|
6
AST2.ml
6
AST2.ml
@ -18,7 +18,7 @@ module O = struct
|
||||
PVar of var_name
|
||||
| PWild
|
||||
| PInt of Z.t
|
||||
| PBytes of MBytes.t
|
||||
| PBytes of Hex.t
|
||||
| PString of string
|
||||
| PUnit
|
||||
| PFalse
|
||||
@ -81,7 +81,7 @@ module O = struct
|
||||
|
||||
and constant =
|
||||
Unit
|
||||
| Int of Z.t | String of string | Bytes of MBytes.t
|
||||
| Int of Z.t | String of string | Bytes of Hex.t
|
||||
| False | True
|
||||
| Null of type_expr
|
||||
| EmptySet of type_expr
|
||||
@ -654,7 +654,7 @@ let s_ast (ast : I.ast) : O.ast =
|
||||
(* and s_bytes {region; value = lexeme, abstract} = *)
|
||||
(* printf "%s: Bytes (\"%s\", \"0x%s\")\n" *)
|
||||
(* (compact region) lexeme *)
|
||||
(* (MBytes.to_hex abstract |> Hex.to_string) *)
|
||||
(* (Hex.to_string abstract) *)
|
||||
|
||||
(* and s_int {region; value = lexeme, abstract} = *)
|
||||
(* printf "%s: Int (\"%s\", %s)\n" *)
|
||||
|
@ -29,7 +29,7 @@ type t =
|
||||
(* Literals *)
|
||||
|
||||
String of lexeme Region.reg
|
||||
| Bytes of (lexeme * MBytes.t) Region.reg
|
||||
| Bytes of (lexeme * Hex.t) Region.reg
|
||||
| Int of (lexeme * Z.t) Region.reg
|
||||
| Ident of lexeme Region.reg
|
||||
| Constr of lexeme Region.reg
|
||||
|
@ -28,7 +28,7 @@ type t =
|
||||
(* Literals *)
|
||||
|
||||
String of lexeme Region.reg
|
||||
| Bytes of (lexeme * MBytes.t) Region.reg
|
||||
| Bytes of (lexeme * Hex.t) Region.reg
|
||||
| Int of (lexeme * Z.t) Region.reg
|
||||
| Ident of lexeme Region.reg
|
||||
| Constr of lexeme Region.reg
|
||||
@ -142,7 +142,7 @@ let proj_token = function
|
||||
| Bytes Region.{region; value = s,b} ->
|
||||
region,
|
||||
sprintf "Bytes (\"%s\", \"0x%s\")"
|
||||
s (MBytes.to_hex b |> Hex.to_string)
|
||||
s (Hex.to_string b)
|
||||
|
||||
| Int Region.{region; value = s,n} ->
|
||||
region, sprintf "Int (\"%s\", %s)" s (Z.to_string n)
|
||||
@ -470,7 +470,7 @@ let mk_string lexeme region = String Region.{region; value=lexeme}
|
||||
|
||||
let mk_bytes lexeme region =
|
||||
let norm = Str.(global_replace (regexp "_") "" lexeme) in
|
||||
let value = lexeme, MBytes.of_hex (Hex.of_string norm)
|
||||
let value = lexeme, Hex.of_string norm
|
||||
in Bytes Region.{region; value}
|
||||
|
||||
type int_err = Non_canonical_zero
|
||||
|
@ -1,6 +0,0 @@
|
||||
(* TEMPORARY: SHOULD BE ERASED *)
|
||||
|
||||
type t = Hex.t
|
||||
|
||||
let of_hex x = x
|
||||
let to_hex x = x
|
@ -1,6 +0,0 @@
|
||||
(* TEMPORARY: SHOULD BE ERASED *)
|
||||
|
||||
type t
|
||||
|
||||
val of_hex : Hex.t -> t
|
||||
val to_hex : t -> Hex.t
|
@ -6,7 +6,7 @@
|
||||
(* Literals *)
|
||||
|
||||
%token <LexToken.lexeme Region.reg> String
|
||||
%token <(LexToken.lexeme * MBytes.t) Region.reg> Bytes
|
||||
%token <(LexToken.lexeme * Hex.t) Region.reg> Bytes
|
||||
%token <(LexToken.lexeme * Z.t) Region.reg> Int
|
||||
%token <LexToken.lexeme Region.reg> Ident
|
||||
%token <LexToken.lexeme Region.reg> Constr
|
||||
|
BIN
Parser.exe
BIN
Parser.exe
Binary file not shown.
@ -19,7 +19,7 @@ entrypoint contribute (storage store : store;
|
||||
else
|
||||
case store.backers[sender] of
|
||||
None -> store.backers[sender] := Some (amount)
|
||||
// patch store.backers with map sender -> amount end
|
||||
// None -> patch store.backers with map sender -> amount end
|
||||
| _ -> skip
|
||||
end
|
||||
end with (store, operations)
|
||||
@ -32,8 +32,8 @@ entrypoint withdraw (storage store : store; const sender : address)
|
||||
if now >= store.deadline then
|
||||
if balance >= store.goal then
|
||||
begin
|
||||
// patch store with record funded = True end;
|
||||
store.funded := True;
|
||||
// patch store with record funded = True end;
|
||||
operations := [Transfer (owner, balance)]
|
||||
end
|
||||
else fail "Below target"
|
||||
|
@ -18,7 +18,7 @@ module O = struct
|
||||
PVar of var_name
|
||||
| PWild
|
||||
| PInt of Z.t
|
||||
| PBytes of MBytes.t
|
||||
| PBytes of Hex.t
|
||||
| PString of string
|
||||
| PUnit
|
||||
| PFalse
|
||||
@ -85,7 +85,7 @@ module O = struct
|
||||
|
||||
and constant =
|
||||
Unit
|
||||
| Int of Z.t | String of string | Bytes of MBytes.t
|
||||
| Int of Z.t | String of string | Bytes of Hex.t
|
||||
| False | True
|
||||
| Null
|
||||
| EmptySet
|
||||
@ -272,4 +272,3 @@ let a_ast I.{types; storage_decl; declarations; orig} =
|
||||
O.{types; storage_decl; declarations; orig}
|
||||
|
||||
let annotate : I.ast -> O.ast = a_ast
|
||||
|
||||
|
@ -16,7 +16,7 @@ module O : sig
|
||||
PVar of var_name
|
||||
| PWild
|
||||
| PInt of Z.t
|
||||
| PBytes of MBytes.t
|
||||
| PBytes of Hex.t
|
||||
| PString of string
|
||||
| PUnit
|
||||
| PFalse
|
||||
@ -83,7 +83,7 @@ module O : sig
|
||||
|
||||
and constant =
|
||||
Unit
|
||||
| Int of Z.t | String of string | Bytes of MBytes.t
|
||||
| Int of Z.t | String of string | Bytes of Hex.t
|
||||
| False | True
|
||||
| Null
|
||||
| EmptySet
|
||||
|
Loading…
Reference in New Issue
Block a user