src/HOL/MicroJava/J/Example.thy
changeset 11070 cc421547e744
parent 11026 a50365d21144
child 11372 648795477bb5
equal deleted inserted replaced
11069:4f6fd393713f 11070:cc421547e744
     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 
    24   public static void main (String args[]) {
    32   public static void main (String args[]) {
    25     Base e=new Ext();
    33     Base e=new Ext();
    26     e.foo(null);
    34     e.foo(null);
    27   }
    35   }
    28 }
    36 }
    29 *)
    37 \end{verbatim}
    30 
    38 *}
    31 theory Example = Eval:
       
    32 
    39 
    33 datatype cnam_ = Base_ | Ext_
    40 datatype cnam_ = Base_ | Ext_
    34 datatype vnam_ = vee_ | x_ | e_
    41 datatype vnam_ = vee_ | x_ | e_
    35 
    42 
    36 consts
    43 consts