1 (* Title: isabelle/Bali/Example.thy |
1 (* Title: isabelle/Bali/Example.thy |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: David von Oheimb |
3 Author: David von Oheimb |
4 Copyright 1997 Technische Universitaet Muenchen |
4 Copyright 1997 Technische Universitaet Muenchen |
5 |
5 *) |
6 The following example Bali program includes: |
6 |
|
7 header "Example MicroJava Program" |
|
8 |
|
9 theory Example = Eval: |
|
10 |
|
11 text {* |
|
12 The following example MicroJava program includes: |
7 class declarations with inheritance, hiding of fields, and overriding of |
13 class declarations with inheritance, hiding of fields, and overriding of |
8 methods (with refined result type), |
14 methods (with refined result type), |
9 instance creation, local assignment, sequential composition, |
15 instance creation, local assignment, sequential composition, |
10 method call with dynamic binding, literal values, |
16 method call with dynamic binding, literal values, |
11 expression statement, local access, type cast, field assignment (in part), skip |
17 expression statement, local access, type cast, field assignment (in part), |
12 |
18 skip. |
|
19 |
|
20 \begin{verbatim} |
13 class Base { |
21 class Base { |
14 boolean vee; |
22 boolean vee; |
15 Base foo(Base x) {return x;} |
23 Base foo(Base x) {return x;} |
16 } |
24 } |
17 |
25 |