4 |
4 |
5 header {* \isaheader{Expressions and Statements} *} |
5 header {* \isaheader{Expressions and Statements} *} |
6 |
6 |
7 theory Term imports Value begin |
7 theory Term imports Value begin |
8 |
8 |
9 datatype binop = Eq | Add -- "function codes for binary operation" |
9 datatype_new binop = Eq | Add -- "function codes for binary operation" |
10 |
10 |
11 datatype expr |
11 datatype_new expr |
12 = NewC cname -- "class instance creation" |
12 = NewC cname -- "class instance creation" |
13 | Cast cname expr -- "type cast" |
13 | Cast cname expr -- "type cast" |
14 | Lit val -- "literal value, also references" |
14 | Lit val -- "literal value, also references" |
15 | BinOp binop expr expr -- "binary operation" |
15 | BinOp binop expr expr -- "binary operation" |
16 | LAcc vname -- "local (incl. parameter) access" |
16 | LAcc vname -- "local (incl. parameter) access" |
19 | FAss cname expr vname |
19 | FAss cname expr vname |
20 expr ("{_}_.._:=_" [10,90,99,90]90) -- "field ass." |
20 expr ("{_}_.._:=_" [10,90,99,90]90) -- "field ass." |
21 | Call cname expr mname |
21 | Call cname expr mname |
22 "ty list" "expr list" ("{_}_.._'( {_}_')" [10,90,99,10,10] 90) -- "method call" |
22 "ty list" "expr list" ("{_}_.._'( {_}_')" [10,90,99,10,10] 90) -- "method call" |
23 |
23 |
24 datatype stmt |
24 datatype_new stmt |
25 = Skip -- "empty statement" |
25 = Skip -- "empty statement" |
26 | Expr expr -- "expression statement" |
26 | Expr expr -- "expression statement" |
27 | Comp stmt stmt ("_;; _" [61,60]60) |
27 | Comp stmt stmt ("_;; _" [61,60]60) |
28 | Cond expr stmt stmt ("If '(_') _ Else _" [80,79,79]70) |
28 | Cond expr stmt stmt ("If '(_') _ Else _" [80,79,79]70) |
29 | Loop expr stmt ("While '(_') _" [80,79]70) |
29 | Loop expr stmt ("While '(_') _" [80,79]70) |