author | chaieb |
Sun, 22 Jul 2007 17:53:54 +0200 | |
changeset 23906 | e61361aa23b2 |
parent 16417 | 9bc16273c2d4 |
child 41589 | bbd861837ebc |
permissions | -rw-r--r-- |
11376 | 1 |
(* Title: HOL/NanoJava/Term.thy |
2 |
ID: $Id$ |
|
3 |
Author: David von Oheimb |
|
4 |
Copyright 2001 Technische Universitaet Muenchen |
|
5 |
*) |
|
6 |
||
7 |
header "Statements and expression emulations" |
|
8 |
||
16417 | 9 |
theory Term imports Main begin |
11376 | 10 |
|
11558
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
11 |
typedecl cname --{* class name *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
12 |
typedecl mname --{* method name *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
13 |
typedecl fname --{* field name *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
14 |
typedecl vname --{* variable name *} |
11376 | 15 |
|
11558
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
16 |
consts |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
17 |
This :: vname --{* This pointer *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
18 |
Par :: vname --{* method parameter *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
19 |
Res :: vname --{* method result *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
20 |
|
11565 | 21 |
text {* Inequality axioms are not required for the meta theory. *} |
11558
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
22 |
(* |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
23 |
axioms |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
24 |
This_neq_Par [simp]: "This \<noteq> Par" |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
25 |
Par_neq_Res [simp]: "Par \<noteq> Res" |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
26 |
Res_neq_This [simp]: "Res \<noteq> This" |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
27 |
*) |
11376 | 28 |
|
29 |
datatype stmt |
|
11558
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
30 |
= Skip --{* empty statement *} |
11476 | 31 |
| Comp stmt stmt ("_;; _" [91,90 ] 90) |
11565 | 32 |
| Cond expr stmt stmt ("If '(_') _ Else _" [ 3,91,91] 91) |
33 |
| Loop vname stmt ("While '(_') _" [ 3,91 ] 91) |
|
11560 | 34 |
| LAss vname expr ("_ :== _" [99, 95] 94) --{* local assignment *} |
35 |
| FAss expr fname expr ("_.._:==_" [95,99,95] 94) --{* field assignment *} |
|
11558
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
36 |
| Meth "cname \<times> mname" --{* virtual method *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
37 |
| Impl "cname \<times> mname" --{* method implementation *} |
11476 | 38 |
and expr |
11558
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
39 |
= NewC cname ("new _" [ 99] 95) --{* object creation *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
40 |
| Cast cname expr --{* type cast *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
41 |
| LAcc vname --{* local access *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
42 |
| FAcc expr fname ("_.._" [95,99] 95) --{* field access *} |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
43 |
| Call cname expr mname expr |
6539627881e8
simplified vnam/vname, introduced fname, improved comments
oheimb
parents:
11507
diff
changeset
|
44 |
("{_}_.._'(_')" [99,95,99,95] 95) --{* method call *} |
11376 | 45 |
|
46 |
end |
|
47 |