equal
deleted
inserted
replaced
6 section "Types, class Declarations, and whole programs" |
6 section "Types, class Declarations, and whole programs" |
7 |
7 |
8 theory Decl imports Term begin |
8 theory Decl imports Term begin |
9 |
9 |
10 datatype ty |
10 datatype ty |
11 = NT --{* null type *} |
11 = NT \<comment>\<open>null type\<close> |
12 | Class cname --{* class type *} |
12 | Class cname \<comment>\<open>class type\<close> |
13 |
13 |
14 text{* Field declaration *} |
14 text\<open>Field declaration\<close> |
15 type_synonym fdecl |
15 type_synonym fdecl |
16 = "fname \<times> ty" |
16 = "fname \<times> ty" |
17 |
17 |
18 record methd |
18 record methd |
19 = par :: ty |
19 = par :: ty |
20 res :: ty |
20 res :: ty |
21 lcl ::"(vname \<times> ty) list" |
21 lcl ::"(vname \<times> ty) list" |
22 bdy :: stmt |
22 bdy :: stmt |
23 |
23 |
24 text{* Method declaration *} |
24 text\<open>Method declaration\<close> |
25 type_synonym mdecl |
25 type_synonym mdecl |
26 = "mname \<times> methd" |
26 = "mname \<times> methd" |
27 |
27 |
28 record "class" |
28 record "class" |
29 = super :: cname |
29 = super :: cname |
30 flds ::"fdecl list" |
30 flds ::"fdecl list" |
31 methods ::"mdecl list" |
31 methods ::"mdecl list" |
32 |
32 |
33 text{* Class declaration *} |
33 text\<open>Class declaration\<close> |
34 type_synonym cdecl |
34 type_synonym cdecl |
35 = "cname \<times> class" |
35 = "cname \<times> class" |
36 |
36 |
37 type_synonym prog |
37 type_synonym prog |
38 = "cdecl list" |
38 = "cdecl list" |
43 (type) "class" \<leftharpoondown> (type) "cname \<times> fdecl list \<times> mdecl list" |
43 (type) "class" \<leftharpoondown> (type) "cname \<times> fdecl list \<times> mdecl list" |
44 (type) "cdecl" \<leftharpoondown> (type) "cname \<times> class" |
44 (type) "cdecl" \<leftharpoondown> (type) "cname \<times> class" |
45 (type) "prog " \<leftharpoondown> (type) "cdecl list" |
45 (type) "prog " \<leftharpoondown> (type) "cdecl list" |
46 |
46 |
47 axiomatization |
47 axiomatization |
48 Prog :: prog --{* program as a global value *} |
48 Prog :: prog \<comment>\<open>program as a global value\<close> |
49 and |
49 and |
50 Object :: cname --{* name of root class *} |
50 Object :: cname \<comment>\<open>name of root class\<close> |
51 |
51 |
52 |
52 |
53 definition "class" :: "cname \<rightharpoonup> class" where |
53 definition "class" :: "cname \<rightharpoonup> class" where |
54 "class \<equiv> map_of Prog" |
54 "class \<equiv> map_of Prog" |
55 |
55 |