43158
|
1 |
header "Extensions and Variations of IMP"
|
|
2 |
|
|
3 |
theory Procs imports BExp begin
|
|
4 |
|
|
5 |
subsection "Procedures and Local Variables"
|
|
6 |
|
45212
|
7 |
type_synonym pname = string
|
|
8 |
|
43158
|
9 |
datatype
|
|
10 |
com = SKIP
|
45212
|
11 |
| Assign vname aexp ("_ ::= _" [1000, 61] 61)
|
47818
|
12 |
| Seq com com ("_;/ _" [60, 61] 60)
|
43158
|
13 |
| If bexp com com ("(IF _/ THEN _/ ELSE _)" [0, 0, 61] 61)
|
|
14 |
| While bexp com ("(WHILE _/ DO _)" [0, 61] 61)
|
45212
|
15 |
| Var vname com ("(1{VAR _;;/ _})")
|
|
16 |
| Proc pname com com ("(1{PROC _ = _;;/ _})")
|
|
17 |
| CALL pname
|
43158
|
18 |
|
|
19 |
definition "test_com =
|
|
20 |
{VAR ''x'';;
|
51019
|
21 |
{PROC ''p'' = ''x'' ::= N 1;;
|
43158
|
22 |
{PROC ''q'' = CALL ''p'';;
|
|
23 |
{VAR ''x'';;
|
51019
|
24 |
''x'' ::= N 2;
|
|
25 |
{PROC ''p'' = ''x'' ::= N 3;;
|
43158
|
26 |
CALL ''q''; ''y'' ::= V ''x''}}}}}"
|
|
27 |
|
|
28 |
end
|