Changed "do nothing" to "skip".

This commit is contained in:
Christian Rinderknecht 2019-03-18 18:09:15 +01:00
parent 623683839f
commit 46d6df2146
No known key found for this signature in database
GPG Key ID: 9446816CFD267040
7 changed files with 23 additions and 27 deletions

7
AST.ml
View File

@ -58,6 +58,7 @@ type kwd_not = Region.t
type kwd_of = Region.t type kwd_of = Region.t
type kwd_procedure = Region.t type kwd_procedure = Region.t
type kwd_record = Region.t type kwd_record = Region.t
type kwd_skip = Region.t
type kwd_step = Region.t type kwd_step = Region.t
type kwd_storage = Region.t type kwd_storage = Region.t
type kwd_then = Region.t type kwd_then = Region.t
@ -323,7 +324,7 @@ and single_instr =
| Loop of loop | Loop of loop
| ProcCall of fun_call | ProcCall of fun_call
| Fail of fail_instr reg | Fail of fail_instr reg
| DoNothing of Region.t | Skip of kwd_skip
and fail_instr = { and fail_instr = {
kwd_fail : kwd_fail; kwd_fail : kwd_fail;
@ -650,7 +651,7 @@ let instr_to_region = function
| Single Loop For ForInt {region; _} | Single Loop For ForInt {region; _}
| Single Loop For ForCollect {region; _} | Single Loop For ForCollect {region; _}
| Single ProcCall {region; _} | Single ProcCall {region; _}
| Single DoNothing region | Single Skip region
| Single Fail {region; _} | Single Fail {region; _}
| Block {region; _} -> region | Block {region; _} -> region
@ -936,7 +937,7 @@ and print_single_instr = function
| Loop loop -> print_loop loop | Loop loop -> print_loop loop
| ProcCall fun_call -> print_fun_call fun_call | ProcCall fun_call -> print_fun_call fun_call
| Fail {value; _} -> print_fail value | Fail {value; _} -> print_fail value
| DoNothing region -> print_token region "do nothing" | Skip kwd_skip -> print_token kwd_skip "skip"
and print_fail {kwd_fail; fail_expr} = and print_fail {kwd_fail; fail_expr} =
print_token kwd_fail "fail"; print_token kwd_fail "fail";

View File

@ -42,6 +42,7 @@ type kwd_not = Region.t
type kwd_of = Region.t type kwd_of = Region.t
type kwd_procedure = Region.t type kwd_procedure = Region.t
type kwd_record = Region.t type kwd_record = Region.t
type kwd_skip = Region.t
type kwd_step = Region.t type kwd_step = Region.t
type kwd_storage = Region.t type kwd_storage = Region.t
type kwd_then = Region.t type kwd_then = Region.t
@ -307,7 +308,7 @@ and single_instr =
| Loop of loop | Loop of loop
| ProcCall of fun_call | ProcCall of fun_call
| Fail of fail_instr reg | Fail of fail_instr reg
| DoNothing of Region.t | Skip of kwd_skip
and fail_instr = { and fail_instr = {
kwd_fail : kwd_fail; kwd_fail : kwd_fail;

View File

@ -70,7 +70,6 @@ type t =
| Begin of Region.t (* "begin" *) | Begin of Region.t (* "begin" *)
| Const of Region.t (* "const" *) | Const of Region.t (* "const" *)
| Copy of Region.t (* "copy" *) | Copy of Region.t (* "copy" *)
| Do of Region.t (* "do" *)
| Down of Region.t (* "down" *) | Down of Region.t (* "down" *)
| Fail of Region.t (* "fail" *) | Fail of Region.t (* "fail" *)
| If of Region.t (* "if" *) | If of Region.t (* "if" *)
@ -86,9 +85,9 @@ type t =
| Then of Region.t (* "then" *) | Then of Region.t (* "then" *)
| Else of Region.t (* "else" *) | Else of Region.t (* "else" *)
| Match of Region.t (* "match" *) | Match of Region.t (* "match" *)
| Nothing of Region.t (* "nothing" *)
| Procedure of Region.t (* "procedure" *) | Procedure of Region.t (* "procedure" *)
| Record of Region.t (* "record" *) | Record of Region.t (* "record" *)
| Skip of Region.t (* "skip" *)
| Step of Region.t (* "step" *) | Step of Region.t (* "step" *)
| Storage of Region.t (* "storage" *) | Storage of Region.t (* "storage" *)
| To of Region.t (* "to" *) | To of Region.t (* "to" *)

View File

@ -69,7 +69,6 @@ type t =
| Begin of Region.t | Begin of Region.t
| Const of Region.t | Const of Region.t
| Copy of Region.t | Copy of Region.t
| Do of Region.t
| Down of Region.t | Down of Region.t
| Fail of Region.t | Fail of Region.t
| If of Region.t | If of Region.t
@ -85,9 +84,9 @@ type t =
| Then of Region.t | Then of Region.t
| Else of Region.t | Else of Region.t
| Match of Region.t | Match of Region.t
| Nothing of Region.t
| Procedure of Region.t | Procedure of Region.t
| Record of Region.t | Record of Region.t
| Skip of Region.t
| Step of Region.t | Step of Region.t
| Storage of Region.t | Storage of Region.t
| To of Region.t | To of Region.t
@ -189,7 +188,6 @@ let proj_token = function
| Begin region -> region, "Begin" | Begin region -> region, "Begin"
| Const region -> region, "Const" | Const region -> region, "Const"
| Copy region -> region, "Copy" | Copy region -> region, "Copy"
| Do region -> region, "Do"
| Down region -> region, "Down" | Down region -> region, "Down"
| Fail region -> region, "Fail" | Fail region -> region, "Fail"
| If region -> region, "If" | If region -> region, "If"
@ -205,9 +203,9 @@ let proj_token = function
| Then region -> region, "Then" | Then region -> region, "Then"
| Else region -> region, "Else" | Else region -> region, "Else"
| Match region -> region, "Match" | Match region -> region, "Match"
| Nothing region -> region, "Nothing"
| Procedure region -> region, "Procedure" | Procedure region -> region, "Procedure"
| Record region -> region, "Record" | Record region -> region, "Record"
| Skip region -> region, "Skip"
| Step region -> region, "Step" | Step region -> region, "Step"
| Storage region -> region, "Storage" | Storage region -> region, "Storage"
| To region -> region, "To" | To region -> region, "To"
@ -274,7 +272,6 @@ let to_lexeme = function
| Begin _ -> "begin" | Begin _ -> "begin"
| Const _ -> "const" | Const _ -> "const"
| Copy _ -> "copy" | Copy _ -> "copy"
| Do _ -> "do"
| Down _ -> "down" | Down _ -> "down"
| Fail _ -> "fail" | Fail _ -> "fail"
| If _ -> "if" | If _ -> "if"
@ -290,9 +287,9 @@ let to_lexeme = function
| Then _ -> "then" | Then _ -> "then"
| Else _ -> "else" | Else _ -> "else"
| Match _ -> "match" | Match _ -> "match"
| Nothing _ -> "nothing"
| Procedure _ -> "procedure" | Procedure _ -> "procedure"
| Record _ -> "record" | Record _ -> "record"
| Skip _ -> "skip"
| Step _ -> "step" | Step _ -> "step"
| Storage _ -> "storage" | Storage _ -> "storage"
| To _ -> "to" | To _ -> "to"
@ -327,7 +324,6 @@ let keywords = [
(fun reg -> Begin reg); (fun reg -> Begin reg);
(fun reg -> Const reg); (fun reg -> Const reg);
(fun reg -> Copy reg); (fun reg -> Copy reg);
(fun reg -> Do reg);
(fun reg -> Down reg); (fun reg -> Down reg);
(fun reg -> Fail reg); (fun reg -> Fail reg);
(fun reg -> If reg); (fun reg -> If reg);
@ -343,9 +339,9 @@ let keywords = [
(fun reg -> Then reg); (fun reg -> Then reg);
(fun reg -> Else reg); (fun reg -> Else reg);
(fun reg -> Match reg); (fun reg -> Match reg);
(fun reg -> Nothing reg);
(fun reg -> Procedure reg); (fun reg -> Procedure reg);
(fun reg -> Record reg); (fun reg -> Record reg);
(fun reg -> Skip reg);
(fun reg -> Step reg); (fun reg -> Step reg);
(fun reg -> Storage reg); (fun reg -> Storage reg);
(fun reg -> To reg); (fun reg -> To reg);
@ -363,6 +359,7 @@ let reserved =
|> add "assert" |> add "assert"
|> add "class" |> add "class"
|> add "constraint" |> add "constraint"
|> add "do"
|> add "done" |> add "done"
|> add "downto" |> add "downto"
|> add "exception" |> add "exception"
@ -551,7 +548,6 @@ let is_kwd = function
Begin _ Begin _
| Const _ | Const _
| Copy _ | Copy _
| Do _
| Down _ | Down _
| Fail _ | Fail _
| If _ | If _
@ -567,9 +563,9 @@ let is_kwd = function
| Then _ | Then _
| Else _ | Else _
| Match _ | Match _
| Nothing _
| Procedure _ | Procedure _
| Record _ | Record _
| Skip _
| Step _ | Step _
| Storage _ | Storage _
| To _ | To _

View File

@ -47,7 +47,6 @@
%token <Region.t> Begin (* "begin" *) %token <Region.t> Begin (* "begin" *)
%token <Region.t> Const (* "const" *) %token <Region.t> Const (* "const" *)
%token <Region.t> Copy (* "copy" *) %token <Region.t> Copy (* "copy" *)
%token <Region.t> Do (* "do" *)
%token <Region.t> Down (* "down" *) %token <Region.t> Down (* "down" *)
%token <Region.t> Fail (* "fail" *) %token <Region.t> Fail (* "fail" *)
%token <Region.t> If (* "if" *) %token <Region.t> If (* "if" *)
@ -63,9 +62,9 @@
%token <Region.t> Then (* "then" *) %token <Region.t> Then (* "then" *)
%token <Region.t> Else (* "else" *) %token <Region.t> Else (* "else" *)
%token <Region.t> Match (* "match" *) %token <Region.t> Match (* "match" *)
%token <Region.t> Nothing (* "nothing" *)
%token <Region.t> Procedure (* "procedure" *) %token <Region.t> Procedure (* "procedure" *)
%token <Region.t> Record (* "record" *) %token <Region.t> Record (* "record" *)
%token <Region.t> Skip (* "skip" *)
%token <Region.t> Step (* "step" *) %token <Region.t> Step (* "step" *)
%token <Region.t> Storage (* "storage" *) %token <Region.t> Storage (* "storage" *)
%token <Region.t> To (* "to" *) %token <Region.t> To (* "to" *)

View File

@ -413,13 +413,13 @@ instruction:
| block { Block $1 } | block { Block $1 }
single_instr: single_instr:
conditional { Cond $1 } conditional { Cond $1 }
| match_instr { Match $1 } | match_instr { Match $1 }
| assignment { Assign $1 } | assignment { Assign $1 }
| loop { Loop $1 } | loop { Loop $1 }
| proc_call { ProcCall $1 } | proc_call { ProcCall $1 }
| fail_instr { Fail $1 } | fail_instr { Fail $1 }
| Do Nothing { let region = cover $1 $2 in DoNothing region } | Skip { Skip $1 }
fail_instr: fail_instr:
Fail expr { Fail expr {

View File

@ -22,7 +22,7 @@ entrypoint contribute (storage store : state;
record record
backers = add_binding ((sender, amount), store.backers) backers = add_binding ((sender, amount), store.backers)
end end
| _ -> do nothing | _ -> skip
end end
end with (store, operations) end with (store, operations)
@ -39,7 +39,7 @@ entrypoint get_funds (storage store : state; const sender : address)
end end
else fail "Below target" else fail "Below target"
else fail "Too soon" else fail "Too soon"
else do nothing else skip
end with (store, operations) end with (store, operations)
entrypoint claim (storage store : state; const sender : address) entrypoint claim (storage store : state; const sender : address)