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_procedure = Region.t
type kwd_record = Region.t
type kwd_skip = Region.t
type kwd_step = Region.t
type kwd_storage = Region.t
type kwd_then = Region.t
@ -323,7 +324,7 @@ and single_instr =
| Loop of loop
| ProcCall of fun_call
| Fail of fail_instr reg
| DoNothing of Region.t
| Skip of kwd_skip
and fail_instr = {
kwd_fail : kwd_fail;
@ -650,7 +651,7 @@ let instr_to_region = function
| Single Loop For ForInt {region; _}
| Single Loop For ForCollect {region; _}
| Single ProcCall {region; _}
| Single DoNothing region
| Single Skip region
| Single Fail {region; _}
| Block {region; _} -> region
@ -936,7 +937,7 @@ and print_single_instr = function
| Loop loop -> print_loop loop
| ProcCall fun_call -> print_fun_call fun_call
| 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} =
print_token kwd_fail "fail";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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