diff --git a/AST.ml b/AST.ml index a40e21308..7eefad490 100644 --- a/AST.ml +++ b/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" diff --git a/AST.mli b/AST.mli index 31e317ff5..d1b02e081 100644 --- a/AST.mli +++ b/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 diff --git a/AST2.ml b/AST2.ml index 78a181f79..c09011c9c 100644 --- a/AST2.ml +++ b/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" *) diff --git a/LexToken.mli b/LexToken.mli index 4ac097d6c..b1503bd99 100644 --- a/LexToken.mli +++ b/LexToken.mli @@ -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 diff --git a/LexToken.mll b/LexToken.mll index a0d17b2c5..d7530b948 100644 --- a/LexToken.mll +++ b/LexToken.mll @@ -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 diff --git a/MBytes.ml b/MBytes.ml deleted file mode 100644 index d79e14295..000000000 --- a/MBytes.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* TEMPORARY: SHOULD BE ERASED *) - -type t = Hex.t - -let of_hex x = x -let to_hex x = x diff --git a/MBytes.mli b/MBytes.mli deleted file mode 100644 index 2d0503b26..000000000 --- a/MBytes.mli +++ /dev/null @@ -1,6 +0,0 @@ -(* TEMPORARY: SHOULD BE ERASED *) - -type t - -val of_hex : Hex.t -> t -val to_hex : t -> Hex.t diff --git a/ParToken.mly b/ParToken.mly index e30451699..2ffbd93ad 100644 --- a/ParToken.mly +++ b/ParToken.mly @@ -5,11 +5,11 @@ (* Literals *) -%token String -%token <(LexToken.lexeme * MBytes.t) Region.reg> Bytes -%token <(LexToken.lexeme * Z.t) Region.reg> Int -%token Ident -%token Constr +%token String +%token <(LexToken.lexeme * Hex.t) Region.reg> Bytes +%token <(LexToken.lexeme * Z.t) Region.reg> Int +%token Ident +%token Constr (* Symbols *) diff --git a/Parser.exe b/Parser.exe deleted file mode 100755 index 66f3a7131..000000000 Binary files a/Parser.exe and /dev/null differ diff --git a/Tests/crowdfunding.ligo b/Tests/crowdfunding.ligo index e60a2a86e..c1a909f3a 100644 --- a/Tests/crowdfunding.ligo +++ b/Tests/crowdfunding.ligo @@ -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" diff --git a/Typecheck2.ml b/Typecheck2.ml index 1bd6fee69..fe62ead71 100644 --- a/Typecheck2.ml +++ b/Typecheck2.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 @@ -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 - diff --git a/Typecheck2.mli b/Typecheck2.mli index e73f6a875..0a9003ae7 100644 --- a/Typecheck2.mli +++ b/Typecheck2.mli @@ -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