src/HOL/IMP/Procs.thy
author bulwahn
Fri Oct 21 11:17:14 2011 +0200 (2011-10-21)
changeset 45231 d85a2fdc586c
parent 45212 e87feee00a4c
child 47818 151d137f1095
permissions -rw-r--r--
replacing code_inline by code_unfold, removing obsolete code_unfold, code_inline del now that the ancient code generator is removed
kleing@43158
     1
header "Extensions and Variations of IMP"
kleing@43158
     2
kleing@43158
     3
theory Procs imports BExp begin
kleing@43158
     4
kleing@43158
     5
subsection "Procedures and Local Variables"
kleing@43158
     6
nipkow@45212
     7
type_synonym pname = string
nipkow@45212
     8
kleing@43158
     9
datatype
kleing@43158
    10
  com = SKIP 
nipkow@45212
    11
      | Assign vname aexp        ("_ ::= _" [1000, 61] 61)
kleing@43158
    12
      | Semi   com  com          ("_;/ _"  [60, 61] 60)
kleing@43158
    13
      | If     bexp com com     ("(IF _/ THEN _/ ELSE _)"  [0, 0, 61] 61)
kleing@43158
    14
      | While  bexp com         ("(WHILE _/ DO _)"  [0, 61] 61)
nipkow@45212
    15
      | Var    vname com        ("(1{VAR _;;/ _})")
nipkow@45212
    16
      | Proc   pname com com    ("(1{PROC _ = _;;/ _})")
nipkow@45212
    17
      | CALL   pname
kleing@43158
    18
kleing@43158
    19
definition "test_com =
kleing@43158
    20
{VAR ''x'';;
kleing@43158
    21
 ''x'' ::= N 0;
kleing@43158
    22
 {PROC ''p'' = ''x'' ::= Plus (V ''x'') (V ''x'');;
kleing@43158
    23
  {PROC ''q'' = CALL ''p'';;
kleing@43158
    24
   {VAR ''x'';;
kleing@43158
    25
    ''x'' ::= N 5;
kleing@43158
    26
    {PROC ''p'' = ''x'' ::= Plus (V ''x'') (N 1);;
kleing@43158
    27
     CALL ''q''; ''y'' ::= V ''x''}}}}}"
kleing@43158
    28
kleing@43158
    29
end