equal
deleted
inserted
replaced
1 (* Title: HOL/NanoJava/Decl.thy |
1 (* Title: HOL/NanoJava/Decl.thy |
2 ID: $Id$ |
|
3 Author: David von Oheimb |
2 Author: David von Oheimb |
4 Copyright 2001 Technische Universitaet Muenchen |
3 Copyright 2001 Technische Universitaet Muenchen |
5 *) |
4 *) |
6 |
5 |
7 header "Types, class Declarations, and whole programs" |
6 header "Types, class Declarations, and whole programs" |
11 datatype ty |
10 datatype ty |
12 = NT --{* null type *} |
11 = NT --{* null type *} |
13 | Class cname --{* class type *} |
12 | Class cname --{* class type *} |
14 |
13 |
15 text{* Field declaration *} |
14 text{* Field declaration *} |
16 types fdecl |
15 types fdecl |
17 = "fname \<times> ty" |
16 = "fname \<times> ty" |
18 |
17 |
19 record methd |
18 record methd |
20 = par :: ty |
19 = par :: ty |
21 res :: ty |
20 res :: ty |
22 lcl ::"(vname \<times> ty) list" |
21 lcl ::"(vname \<times> ty) list" |
23 bdy :: stmt |
22 bdy :: stmt |
24 |
23 |
25 text{* Method declaration *} |
24 text{* Method declaration *} |
26 types mdecl |
25 types mdecl |
27 = "mname \<times> methd" |
26 = "mname \<times> methd" |
28 |
27 |
29 record "class" |
28 record "class" |
30 = super :: cname |
29 = super :: cname |
31 flds ::"fdecl list" |
30 flds ::"fdecl list" |
32 methods ::"mdecl list" |
31 methods ::"mdecl list" |
33 |
32 |
34 text{* Class declaration *} |
33 text{* Class declaration *} |
35 types cdecl |
34 types cdecl |
36 = "cname \<times> class" |
35 = "cname \<times> class" |
37 |
36 |
38 types prog |
37 types prog |
39 = "cdecl list" |
38 = "cdecl list" |
40 |
39 |
41 translations |
40 translations |
45 "cdecl" \<leftharpoondown> (type)"cname \<times> class" |
44 "cdecl" \<leftharpoondown> (type)"cname \<times> class" |
46 "prog " \<leftharpoondown> (type)"cdecl list" |
45 "prog " \<leftharpoondown> (type)"cdecl list" |
47 |
46 |
48 consts |
47 consts |
49 |
48 |
50 Prog :: prog --{* program as a global value *} |
49 Prog :: prog --{* program as a global value *} |
51 Object :: cname --{* name of root class *} |
50 Object :: cname --{* name of root class *} |
52 |
51 |
53 |
52 |
54 constdefs |
53 constdefs |
55 "class" :: "cname \<rightharpoonup> class" |
54 "class" :: "cname \<rightharpoonup> class" |
56 "class \<equiv> map_of Prog" |
55 "class \<equiv> map_of Prog" |
57 |
56 |
58 is_class :: "cname => bool" |
57 is_class :: "cname => bool" |
59 "is_class C \<equiv> class C \<noteq> None" |
58 "is_class C \<equiv> class C \<noteq> None" |
60 |
59 |