src/Pure/Thy/syntax.ML
author paulson
Tue, 22 Jul 1997 11:14:18 +0200
changeset 3538 ed9de44032e0
parent 257 b36874cf3b0b
permissions -rw-r--r--
Removal of the tactical STATE
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
     1
(*  Title:      Pure/Thy/syntax.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
     3
    Author:     Sonia Mahjoub and Tobias Nipkow and Markus Wenzel, TU Muenchen
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
Definition of theory syntax together with translation to ML code.
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
signature THYSYN =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
 sig
123
0a2f744e008a moved call of store_theory to end of use t.thy; use t.ML;
clasohm
parents: 81
diff changeset
    10
  datatype basetype = Thy  of string
81
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
    11
                    | File of string
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
    12
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
   val read: string list -> string
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
 end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
functor ThySynFUN (Parse: PARSE): THYSYN =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
struct
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
(*-------------- OBJECT TO STRING TRANSLATION ---------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
fun parent s = "(" ^ s ^ ")";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    26
fun pair(a, b) = parent(a ^ ", " ^ b);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    28
fun triple(a, b, c) = parent(a ^ ", " ^ b ^ ", " ^ c);
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    29
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    30
fun pair_quote(a, b) = pair(quote a, quote b);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    32
fun pair_quote2(a, b) = pair(a, quote b);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
fun bracket s = "[" ^ s ^ "]";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
val comma = space_implode ", ";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
val bracket_comma = bracket o comma;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
val big_bracket_comma = bracket o space_implode ",\n";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
fun big_bracket_comma_ind ind strs = bracket (space_implode (",\n" ^ ind) strs);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    44
val bracket_comma_quote = bracket_comma o (map quote);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
(*------------------- ABSTRACT SYNTAX FUNCTIONS ---------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
datatype mixfix = Mixfix of string * string * string
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
                | Delimfix of string
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
                | Infixl of string
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
                | Infixr of string
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
                | Binder of string * string
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
                | TInfixl of string
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
                | TInfixr of string;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
datatype pfix_or_mfix = Pref of string | Mixf of string;
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    59
datatype type_or_abbr = Typed of pfix_or_mfix | Abbrd of pfix_or_mfix;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
fun pm_proj(Pref s) = s
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
  | pm_proj(Mixf s) = s;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    64
fun ta_proj(Typed s) = s
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    65
  | ta_proj(Abbrd s) = s;
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    66
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
fun split_decls l =
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    68
    let val (p, m) = partition (fn Pref _ => true | _ => false) l;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
    in (big_bracket_comma_ind "   " (map pm_proj p), map pm_proj m) end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    71
fun split_decls_type l =
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    72
  let val (t,a) = partition (fn Typed _ => true | _ => false) l
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    73
      val (tp,tm) = partition (fn Pref _ => true | _ => false) (map ta_proj t)
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    74
      val (ap,am) = partition (fn Pref _ => true | _ => false) (map ta_proj a)
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    75
    in (big_bracket_comma_ind "   " (map pm_proj tp),
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    76
         big_bracket_comma_ind "   " (map pm_proj ap),
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    77
         (map pm_proj tm) @ (map pm_proj am))
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    78
  end;
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    79
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
    80
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    81
fun delim_mix (s, None) = Delimfix(s)
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    82
  | delim_mix (s, Some(l, n)) = Mixfix(s, l, n);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    83
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    84
fun mixfix (sy, c, ty, l, n) =  "Mixfix(" ^ comma[quote sy, c, ty, l, n] ^ ")";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    85
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    86
fun infixrl(ty, c, n) = parent(comma[ty, c, n]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    87
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    88
fun binder(sy, c, ty, n) = "Binder(" ^ comma[quote sy, c, ty, "0", n] ^ ")";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    89
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    90
fun delimfix (sy, c, ty) = "Delimfix(" ^ comma[quote sy, c, ty] ^ ")";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    91
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    92
fun tinfixrl (ty, n) = "(" ^ comma[ty, ty, n] ^ ")";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    93
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    94
fun mk_mfix((c, ty), mfix) =
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
    95
      let val cs = quote c and tys = quote ty
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    96
      in case mfix of
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    97
           Mixfix(sy, l, n) => mixfix (sy, tys, cs, l, n)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    98
         | Infixr(n) => "Infixr" ^ infixrl(cs, tys, n)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    99
         | Infixl(n) => "Infixl" ^ infixrl(cs, tys, n)
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   100
         | Binder(sy, n) => binder(sy, tys, cs, n)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   101
         | TInfixl(n) => "TInfixl" ^ tinfixrl(cs, n)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
         | TInfixr(n) => "TInfixr" ^ tinfixrl(cs, n)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   103
         | Delimfix(sy) => delimfix(sy, tys, cs)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   104
      end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   107
fun mk_mixfix((cs, ty), None) =
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   108
      [Pref(pair(bracket_comma_quote cs, quote ty))]
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   109
  | mk_mixfix((c::cs, ty), Some(mfix)) =
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   110
      Mixf(mk_mfix((c, ty), mfix)) :: mk_mixfix((cs, ty), Some(mfix))
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   111
  | mk_mixfix(([], _), _) = [];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   112
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   113
fun mk_type_decl((ts, n), None) = [Typed(Pref(pair(bracket_comma_quote ts, n)))]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   114
  | mk_type_decl((t::ts, n), Some(tinfix)) =
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   115
      [Typed(Pref(pair(bracket(quote t), n))), Typed(Mixf(mk_mfix((t, n), tinfix)))] @
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   116
      mk_type_decl((ts, n), Some(tinfix))
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   117
  | mk_type_decl(([], n), Some(tinfix)) = [];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   119
fun mk_abbr_decl(((ts, a), b), None) =
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   120
    [Abbrd(Pref(triple(quote a, ts, quote b)))]
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   121
  | mk_abbr_decl(((ts, a), b), Some(tinfix)) =
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   122
      [Abbrd(Pref(triple(quote a, ts, quote b))), Abbrd(Mixf(mk_mfix((a, "0"), tinfix)))];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   123
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   124
fun mk_extension (((((((cl, def), (ty, ab, tinfix)), ar), (co, mfix)), tr), ax), ml) =
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   125
  ((cl, def, ty, ab, ar, co, ax), big_bracket_comma_ind "    " tinfix,
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
    big_bracket_comma_ind "     " mfix, big_bracket_comma_ind "     " tr, ml);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   128
fun add_val((id, _), s) = "val " ^ id ^ " = get_axiom thy " ^ quote id ^ "\n" ^ s;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
fun mk_rules ps =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
  let
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   132
    val axs = big_bracket_comma_ind "  " (map pair_quote ps);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
    val vals = foldr add_val (ps, "")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   134
  in
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   135
    axs ^ "\n\n" ^ vals
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   137
123
0a2f744e008a moved call of store_theory to end of use t.thy; use t.ML;
clasohm
parents: 81
diff changeset
   138
fun mk_struct (id, s) = "structure " ^ id ^ " =\nstruct\n" ^ s ^ "\nend;\n";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   139
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   140
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   141
fun mk_sext mfix trans =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   142
  "Some (NewSext {\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   143
\   mixfix =\n    " ^ mfix ^ ",\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   144
\   xrules =\n    " ^ trans ^ ",\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   145
\   parse_ast_translation = parse_ast_translation,\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   146
\   parse_translation = parse_translation,\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   147
\   print_translation = print_translation,\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   148
\   print_ast_translation = print_ast_translation})";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   149
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
fun mk_simple_sext mfix =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   151
  "Some (Syntax.simple_sext\n   " ^ mfix ^ ")";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   152
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   153
fun mk_ext ((cl, def, ty, ab, ar, co, ax), sext) =
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   154
  " (" ^ space_implode ",\n  " [cl, def, ty, ab, ar, co, sext] ^ ")\n " ^ ax ^ "\n";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   155
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   156
fun mk_ext_thy (base, name, ext, sext) =
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   157
  "extend_theory (" ^ base ^ ")\n " ^ quote name ^ "\n" ^ mk_ext (ext, sext);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   158
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   159
val preamble =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
  "\nlocal\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   161
  \ val parse_ast_translation = []\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   162
  \ val parse_translation = []\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
  \ val print_translation = []\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
  \ val print_ast_translation = []\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   165
  \in\n\n\
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   166
  \(**** begin of user section ****)\n";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   167
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   168
val postamble = "\n(**** end of user section ****)\n";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   169
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   170
fun mk_structure ((name, base), Some (ext, tinfix, mfix, trans, ml)) =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   171
      let
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   172
        val noext = ("[]", "[]", "[]", "[]", "[]", "[]", "[]");
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   173
        val basethy =
74
208ab8773a73 changes in Readthy:
clasohm
parents: 20
diff changeset
   174
          if tinfix = "[]" then base ^ (quote name)
208ab8773a73 changes in Readthy:
clasohm
parents: 20
diff changeset
   175
          else mk_ext_thy (base ^ (quote name), name ^ "(type infix)", noext, mk_simple_sext tinfix);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   176
        val sext =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   177
          if mfix = "[]" andalso trans = "[]" andalso ml = "" then "None"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   178
          else mk_sext mfix trans;
74
208ab8773a73 changes in Readthy:
clasohm
parents: 20
diff changeset
   179
        val thy = "val thy = " ^ mk_ext_thy (basethy, name, ext, sext);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
      in
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   181
        mk_struct (name, preamble ^ ml ^ postamble ^ thy ^ "\nend")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   182
      end
74
208ab8773a73 changes in Readthy:
clasohm
parents: 20
diff changeset
   183
  | mk_structure ((name, base), None) =
208ab8773a73 changes in Readthy:
clasohm
parents: 20
diff changeset
   184
      mk_struct (name, "\nval thy = " ^ base ^ (quote name));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
123
0a2f744e008a moved call of store_theory to end of use t.thy; use t.ML;
clasohm
parents: 81
diff changeset
   186
datatype basetype = Thy  of string
81
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   187
                  | File of string;
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   188
74
208ab8773a73 changes in Readthy:
clasohm
parents: 20
diff changeset
   189
fun merge thys =
81
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   190
  let fun make_list (Thy t :: ts) =
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   191
            ("Thy \"" ^ t ^ "\"") :: make_list ts
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   192
        | make_list (File t :: ts) =
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   193
            ("File \"" ^ t ^ "\"") :: make_list ts
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   194
        | make_list [] = []
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   195
  in "base_on " ^ (bracket (space_implode "," (make_list thys))) ^ " " end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   196
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   197
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   198
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   199
(*------------------------ PARSERS -------------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   200
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   201
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   202
open Parse
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   203
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   204
(*------------------- VARIOUS PARSERS ----------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   205
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   206
val emptyl = empty >> K "[]";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   207
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   208
val ids  =  list_of1 id >> bracket_comma_quote;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   209
(* -> "[id1, id2, ..., idn]" *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   210
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   211
val stgorids =  list_of1 (stg || id);
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   212
val stgorid = stg || id;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   213
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   214
val sort =    id >> (bracket o quote)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   215
           || "{" $$-- (ids || emptyl) --$$ "}";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   216
(* -> "[id]"
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   217
   -> "[id1, ..., idn]"  *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   218
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   219
val infxl = "infixl" $$-- !! nat
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   220
and infxr = "infixr" $$-- !! nat
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   221
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   222
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   223
(*------------------- CLASSES PARSER ----------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   224
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   225
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   226
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   227
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   228
val class  =  (id >> quote) -- ( "<" $$-- (!! ids)  ||  emptyl)   >> pair;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   229
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   230
(* -> "(id, [id1, ..., idn])"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   231
   ||
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   232
   -> "(id, [])"  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   233
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   234
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   235
val classes =  "classes" $$-- !!(repeat1 class) >> bracket_comma
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   236
            || emptyl;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   237
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   238
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   239
(* "[(id, [..]), ..., (id, [...])]" *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   240
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   241
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   242
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   243
(*------------------- DEFAULT PARSER ---------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   244
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   245
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   246
val default =  "default" $$-- !!sort
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   247
           ||  emptyl;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   248
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   249
(* -> "[]"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   250
   -> "[id]"
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   251
   -> "[id1, ..., idn]"  *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   252
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   253
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   254
(*-------------------- TYPES  PARSER  ----------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   255
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   256
val xtypevar = typevar >> quote;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   257
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   258
val type_vars_decl = xtypevar >> (fn t => [t])
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   259
                 ||  "(" $$-- list_of1(xtypevar) --$$ ")"
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   260
                 ||  empty >> K [];
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   261
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   262
val abbr_vars_decl = xtypevar >> bracket
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   263
                 ||  "(" $$-- list_of1(xtypevar) --$$ ")" >> bracket_comma
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   264
                 ||  empty >> K "[]";
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   265
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   266
val type_decl =  stgorids -- nat
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   267
              || type_vars_decl -- stgorid
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   268
                         >> (fn (ns,t) => ([t], string_of_int(length(ns))));
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   269
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   270
val abbr_decl = abbr_vars_decl -- stgorid --$$ "=" -- stg;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   271
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   272
val tyinfix =  infxl  >> (Some o TInfixl)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   273
            || infxr  >> (Some o TInfixr);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   274
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   275
val type_infix =   "(" $$-- tyinfix --$$ ")"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   276
               || empty                           >> K None;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   277
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   278
val types =  "types" $$--
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   279
                !! (repeat1 ((abbr_decl -- type_infix >> mk_abbr_decl)
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   280
                          || (type_decl -- type_infix >> mk_type_decl)))
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   281
                >> (split_decls_type o flat)
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   282
          || empty >> (K ("[]", "[]", []));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   283
257
b36874cf3b0b syntax for type abbreviations;
wenzelm
parents: 201
diff changeset
   284
  (* ==> ("[(id, nat), ... ]", "[(id, typevars, stg), ...]", [strg, ...]) *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   285
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   286
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   287
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   288
(*-------------------- ARITIES PARSER ----------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   289
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   290
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   291
val sorts =  list_of sort >> bracket_comma;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   293
(* -> "[[id1, ...], ..., [id, ...]]" *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   294
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   295
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   296
val arity =  id                           >> (fn s => pair("[]", quote s))
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   297
          || "(" $$-- sorts --$$")" -- id >> (fn (l, s) => pair(l, quote s));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   298
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   299
(* -> "([], id)"
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   300
   -> "([[id, ..], ..., [id, ..]], id)" *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   301
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   302
val tys = stgorids >> bracket_comma_quote;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   303
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   304
val arities =  "arities" $$-- !! (repeat1 (tys --$$ "::" -- arity >> pair))
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   305
               >> bracket_comma
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   306
            || emptyl;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   307
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   308
(* -> "[([id, ..], ([[id, ...], ...], id))]" *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   309
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   310
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   311
(*--------------------- CONSTS PARSER ---------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   312
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   313
val natlist = "[" $$--  !!(list_of nat --$$ "]") >> bracket_comma
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   314
            || empty                             >> K "[]";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   315
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   316
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   317
  (* "[nat, ...]"  || "[]" *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   318
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   319
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
val prio_opt =  natlist -- nat  >> Some
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   321
             || empty           >> K None;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   322
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   323
val mfix =  stg -- !! prio_opt            >> delim_mix
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   324
         || infxl                         >> Infixl
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   325
         || infxr                         >> Infixr
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   326
         || "binder" $$-- !!(stg -- nat)  >> Binder
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   327
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   328
val const_decl = stgorids -- !! ("::" $$-- stg);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   329
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   330
(*("[exid, ...]", stg)  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   331
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   332
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   333
val mixfix =  "(" $$-- !! (mfix --$$ ")")  >> Some
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   334
           || empty                        >> K None;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   335
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   336
(* (s, e, l, n) *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   337
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   338
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   339
val consts = "consts" $$--
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   340
                 !! (repeat1 (const_decl -- mixfix >> mk_mixfix))
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   341
                 >> (split_decls o flat)
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   342
           || empty >> K ("[]", []);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   343
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   344
(* ("[([exid, ...], stg), ....]", [strg, ..])  *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   345
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   346
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   347
(*---------------- TRANSLATIONS PARSER --------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   348
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   349
val xpat = "(" $$-- id --$$ ")" -- stg >> pair_quote
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   350
         || stg >> (fn s => pair_quote ("logic", s));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   351
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   352
val arrow = $$ "=>" >> K " |-> "
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   353
         || $$ "<=" >> K " <-| "
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   354
         || $$ "==" >> K " <-> ";
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   355
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   356
val xrule = xpat -- !! (arrow -- xpat) >> (fn (xp1, (a, xp2)) => xp1 ^ a ^ xp2);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   357
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   358
val translations = "translations" $$-- !! (repeat1 xrule)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   359
                 || empty;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   360
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   361
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   362
(*------------------- RULES PARSER -----------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   363
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   364
val rules  = "rules" $$-- !! (repeat1 (id -- !! stg) >> mk_rules)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   365
           || emptyl;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   366
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   367
(* "[(id, stg), ...]" *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   368
81
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   369
(*----------------------- BASE PARSER -------------------------*)
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   370
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   371
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   372
fun base toks =
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   373
  let fun make_thy (b, toks) = (Thy b, toks);
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   374
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   375
      fun make_file (b, toks) = (File b, toks);
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   376
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   377
      val (b, toks) = make_thy (id toks)
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   378
                      handle _ => make_file (stg toks)
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   379
  in (b, toks) end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   380
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   381
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   382
(*----------------------- ML_TEXT -------------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   383
20
e6fb60365db9 Pure/Thy/syntax.ML
wenzelm
parents: 0
diff changeset
   384
val mltxt =  txt || empty >> K "";
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   385
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   386
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   387
(*---------------------------------------------------------*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   388
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   389
val extension = "+" $$-- !! (classes -- default -- types -- arities
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   390
                             -- consts -- translations -- rules --$$ "end" -- mltxt)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   391
                       >> (Some o mk_extension)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   392
              || empty >> K None;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   393
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   394
81
4cc5a34292a9 corrected some spelling mistakes;
clasohm
parents: 74
diff changeset
   395
val bases = base -- repeat("+" $$-- base) >> op:: ;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   396
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   397
val theoryDef = !!(id --$$ "=" -- (bases >> merge) -- extension)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   398
                >> mk_structure;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   399
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   400
val read = reader theoryDef
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   401
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   402
end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   403