src/Pure/Thy/syntax.ML
changeset 123 0a2f744e008a
parent 81 4cc5a34292a9
child 201 9e41c6cec27c
equal deleted inserted replaced
122:db9043a8e372 123:0a2f744e008a
     5 Definition of theory syntax together with translation to ML code.
     5 Definition of theory syntax together with translation to ML code.
     6 *)
     6 *)
     7 
     7 
     8 signature THYSYN =
     8 signature THYSYN =
     9  sig
     9  sig
    10   datatype BaseType = Thy  of string
    10   datatype basetype = Thy  of string
    11                     | File of string
    11                     | File of string
    12 
    12 
    13    val read: string list -> string
    13    val read: string list -> string
    14  end;
    14  end;
    15 
    15 
   113     val vals = foldr add_val (ps, "")
   113     val vals = foldr add_val (ps, "")
   114   in
   114   in
   115     axs ^ "\n\n" ^ vals
   115     axs ^ "\n\n" ^ vals
   116   end;
   116   end;
   117 
   117 
   118 fun mk_struct (id, s) = "structure " ^ id ^ " =\nstruct\n" ^ s ^ "\nend;\n"
   118 fun mk_struct (id, s) = "structure " ^ id ^ " =\nstruct\n" ^ s ^ "\nend;\n";
   119                         ^ "store_theory " ^ quote id ^ " " ^ id ^ ".thy;\n";
       
   120 
   119 
   121 
   120 
   122 fun mk_sext mfix trans =
   121 fun mk_sext mfix trans =
   123   "Some (NewSext {\n\
   122   "Some (NewSext {\n\
   124 \   mixfix =\n    " ^ mfix ^ ",\n\
   123 \   mixfix =\n    " ^ mfix ^ ",\n\
   162         mk_struct (name, preamble ^ ml ^ postamble ^ thy ^ "\nend")
   161         mk_struct (name, preamble ^ ml ^ postamble ^ thy ^ "\nend")
   163       end
   162       end
   164   | mk_structure ((name, base), None) =
   163   | mk_structure ((name, base), None) =
   165       mk_struct (name, "\nval thy = " ^ base ^ (quote name));
   164       mk_struct (name, "\nval thy = " ^ base ^ (quote name));
   166 
   165 
   167 datatype BaseType = Thy  of string
   166 datatype basetype = Thy  of string
   168                   | File of string;
   167                   | File of string;
   169 
   168 
   170 fun merge thys =
   169 fun merge thys =
   171   let fun make_list (Thy t :: ts) =
   170   let fun make_list (Thy t :: ts) =
   172             ("Thy \"" ^ t ^ "\"") :: make_list ts
   171             ("Thy \"" ^ t ^ "\"") :: make_list ts