src/Pure/Thy/ROOT.ML
changeset 390 b074205ac50a
parent 74 208ab8773a73
child 413 2a1554524ad5
equal deleted inserted replaced
389:85105a7fb668 390:b074205ac50a
     1 (*  Title:      Pure/Thy/ROOT
     1 (*  Title:      Pure/Thy/ROOT.ML
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Sonia Mahjoub / Tobias Nipkow
     3     Author:     Sonia Mahjoub and Tobias Nipkow and
     4     Copyright   1992  TU Muenchen
     4                 Markus Wenzel and Carsten Clasohm, TU Muenchen
     5 
     5 
     6 This file builds the theory parser.
     6 This file builds the theory parser and autoloading system.
     7 It assumes the standard Isabelle environment.
       
     8 *)
     7 *)
     9 
     8 
    10 use "scan.ML";
     9 (* FIXME remove (still needed by HOL/Datatype.ML) *)
    11 use "parse.ML";
    10 use "scan.ML"; use "parse.ML";
    12 use "syntax.ML";
    11 
    13 use "read.ML";
    12 use "thy_scan.ML";
       
    13 use "thy_parse.ML";
       
    14 use "thy_read.ML";
       
    15 
       
    16 structure ThyScan = ThyScanFun(Scanner);
       
    17 structure ThyParse = ThyParseFun(structure Symtab = Symtab
       
    18   and ThyScan = ThyScan);
       
    19 structure ThyRead = ThyReadFun(structure ThyParse = ThyParse);
       
    20 open ThyRead;
    14 
    21 
    15 
    22 
    16 structure Keyword =
    23 (* FIXME tmp hack *)
    17     struct
       
    18     val alphas =  ["classes", "default", "arities", "types",
       
    19                    "consts", "rules", "end", "rules", "mixfix",
       
    20                    "infixr", "infixl", "binder", "translations"]
       
    21 
    24 
    22     val symbols = [",", "<", "{", "}", "(", ")", "(*", "*)",
    25 fun eval txt =
    23                    "[", "]", "::", "=", "+", "==", "=>", "<="]
    26   let
    24     end;
    27     val tmp_name = "/tmp/.eval.tmp";
       
    28     val tmp_file = open_out tmp_name;
       
    29   in
       
    30     output (tmp_file, txt);
       
    31     close_out tmp_file;
       
    32     use tmp_name;
       
    33     delete_file tmp_name
       
    34   end;
    25 
    35 
    26 structure Lex     = LexicalFUN (Keyword);
       
    27 structure Parse   = ParseFUN (Lex);
       
    28 structure ThySyn  = ThySynFUN (Parse);
       
    29 
    36 
    30 (*This structure is only defined to be compatible with older versions of
    37 fun init_thy_reader () = 
    31   READTHY. Don't use it in newly created theory/ROOT.ML files! Instead
    38   eval   (* FIXME use_string *)
    32   define a new structure. Otherwise Poly/ML won't save a reference variable
    39     "structure ThyRead = ThyReadFun(structure ThyParse = ThyParse);\n\
    33   defined inside the functor. *)
    40     \ThyRead.loaded_thys := ! loaded_thys;\n\
    34 structure Readthy = ReadthyFUN (structure ThySyn = ThySyn);
    41     \open ThyRead;\n";
    35 open Readthy;
       
    36 
    42