src/Pure/Syntax/syntax.ML
author wenzelm
Fri, 16 Jul 1999 22:25:07 +0200
changeset 7025 afbd8241797b
parent 6322 7047300264c9
child 7944 cc1930ad1a88
permissions -rw-r--r--
tuned dest_lexicon;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
     1
(*  Title:      Pure/Syntax/syntax.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
     4
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
     5
Root of Isabelle's syntax module.
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
     8
signature BASIC_SYNTAX =
2383
4127499d9b52 added extend_trfunsT;
wenzelm
parents: 2366
diff changeset
     9
sig
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
    10
  include AST0
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    11
  include SYN_TRANS0
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    12
  include MIXFIX0
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
    13
  include PRINTER0
2383
4127499d9b52 added extend_trfunsT;
wenzelm
parents: 2366
diff changeset
    14
end;
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
    15
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
signature SYNTAX =
2383
4127499d9b52 added extend_trfunsT;
wenzelm
parents: 2366
diff changeset
    17
sig
6322
7047300264c9 token translation: real;
wenzelm
parents: 6167
diff changeset
    18
  include TOKEN_TRANS0
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
    19
  include AST1
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
  include LEXICON0
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    21
  include SYN_EXT0
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
  include TYPE_EXT0
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    23
  include SYN_TRANS1
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    24
  include MIXFIX1
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
  include PRINTER0
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
    26
  datatype 'a trrule =
3526
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
    27
    ParseRule of 'a * 'a |
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
    28
    PrintRule of 'a * 'a |
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
    29
    ParsePrintRule of 'a * 'a
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    30
  type syntax
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    31
  val extend_log_types: syntax -> string list -> syntax
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    32
  val extend_type_gram: syntax -> (string * int * mixfix) list -> syntax
2366
a163d2be1bb5 added chartrans;
wenzelm
parents: 2287
diff changeset
    33
  val extend_const_gram: syntax -> string * bool -> (string * typ * mixfix) list -> syntax
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    34
  val extend_consts: syntax -> string list -> syntax
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    35
  val extend_trfuns: syntax ->
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    36
    (string * (ast list -> ast)) list *
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    37
    (string * (term list -> term)) list *
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    38
    (string * (term list -> term)) list *
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    39
    (string * (ast list -> ast)) list -> syntax
4145
ffb0c9670597 adapted extend_trfunsT;
wenzelm
parents: 4101
diff changeset
    40
  val extend_trfunsT: syntax -> (string * (bool -> typ -> term list -> term)) list -> syntax
6322
7047300264c9 token translation: real;
wenzelm
parents: 6167
diff changeset
    41
  val extend_tokentrfuns: syntax -> (string * string * (string -> string * real)) list -> syntax
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
    42
  val extend_trrules: syntax -> (string * string) trrule list -> syntax
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
    43
  val extend_trrules_i: syntax -> ast trrule list -> syntax
4618
731bed12f762 export map_trrule;
wenzelm
parents: 4496
diff changeset
    44
  val map_trrule: ('a -> 'b) -> 'a trrule -> 'b trrule
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    45
  val merge_syntaxes: syntax -> syntax -> syntax
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    46
  val type_syn: syntax
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
    47
  val pure_syn: syntax
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    48
  val print_gram: syntax -> unit
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    49
  val print_trans: syntax -> unit
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    50
  val print_syntax: syntax -> unit
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    51
  val test_read: syntax -> string -> string -> unit
624
33b9b5da3e6f made major changes to grammar;
clasohm
parents: 556
diff changeset
    52
  val read: syntax -> typ -> string -> term list
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
    53
  val read_typ: syntax -> ((indexname * sort) list -> indexname -> sort) -> string -> typ
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    54
  val simple_read_typ: string -> typ
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
    55
  val pretty_term: syntax -> bool -> term -> Pretty.T
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    56
  val pretty_typ: syntax -> typ -> Pretty.T
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
    57
  val pretty_sort: syntax -> sort -> Pretty.T
3782
c1b4be0e77cb added simple_str_of_sort;
wenzelm
parents: 3779
diff changeset
    58
  val simple_str_of_sort: sort -> string
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    59
  val simple_string_of_typ: typ -> string
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
    60
  val simple_pprint_typ: typ -> pprint_args -> unit
882
b118d1ea0dfd moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents: 865
diff changeset
    61
  val ambiguity_level: int ref
2383
4127499d9b52 added extend_trfunsT;
wenzelm
parents: 2366
diff changeset
    62
end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
1511
09354d37a5ab Elimination of fully-functorial style.
paulson
parents: 1158
diff changeset
    64
structure Syntax : SYNTAX =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
struct
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    66
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    67
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    68
(** tables of translation functions **)
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    69
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    70
fun mk_trfun (c, f) = (c, (f, stamp ()));
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    71
fun eq_trfuns ((c1:string, (_, s1:stamp)), (c2, (_, s2))) = c1 = c2 andalso s1 = s2;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    72
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    73
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    74
(* parse (ast) translations *)
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    75
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    76
fun lookup_tr tab c = apsome fst (Symtab.lookup (tab, c));
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    77
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
    78
fun err_dup_trfuns name cs =
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
    79
  error ("More than one " ^ name ^ " for " ^ commas_quote cs);
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    80
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    81
fun extend_trtab tab trfuns name =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    82
  Symtab.extend (tab, map mk_trfun trfuns)
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
    83
    handle Symtab.DUPS cs => err_dup_trfuns name cs;
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    84
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    85
fun merge_trtabs tab1 tab2 name =
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    86
  Symtab.merge eq_snd (tab1, tab2)
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
    87
    handle Symtab.DUPS cs => err_dup_trfuns name cs;
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    88
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
    89
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    90
(* print (ast) translations *)
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    91
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    92
fun lookup_tr' tab c = map fst (Symtab.lookup_multi (tab, c));
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    93
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    94
fun extend_tr'tab tab trfuns =
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    95
  generic_extend eq_trfuns Symtab.dest_multi Symtab.make_multi tab (map mk_trfun trfuns);
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    96
5702
77ad51744aee made SML/NJ happy;
wenzelm
parents: 5692
diff changeset
    97
fun merge_tr'tabs tabs = generic_merge eq_trfuns Symtab.dest_multi Symtab.make_multi tabs;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    98
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
    99
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   100
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   101
(** tables of token translation functions **)
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   102
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   103
fun lookup_tokentr tabs modes =
4496
16187138463d removed distinct_fst_string;
wenzelm
parents: 4487
diff changeset
   104
  let val trs = gen_distinct eq_fst (flat (map (assocs tabs) (modes @ [""])))
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   105
  in fn c => apsome fst (assoc (trs, c)) end;
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   106
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   107
fun merge_tokentrtabs tabs1 tabs2 =
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   108
  let
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   109
    fun eq_tr ((c1, (_, s1)), (c2, (_, s2))) = c1 = c2 andalso s1 = s2;
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   110
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   111
    fun name (s, _) = implode (tl (Symbol.explode s));
2706
91a640a91c6e improved err msg;
wenzelm
parents: 2700
diff changeset
   112
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   113
    fun merge mode =
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   114
      let
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   115
        val trs1 = assocs tabs1 mode;
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   116
        val trs2 = assocs tabs2 mode;
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   117
        val trs = gen_distinct eq_tr (trs1 @ trs2);
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   118
      in
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   119
        (case gen_duplicates eq_fst trs of
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   120
          [] => (mode, trs)
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   121
        | dups => error ("More than one token translation function in mode " ^
2706
91a640a91c6e improved err msg;
wenzelm
parents: 2700
diff changeset
   122
            quote mode ^ " for " ^ commas_quote (map name dups)))
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   123
      end;
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   124
  in
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   125
    map merge (distinct (map fst (tabs1 @ tabs2)))
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   126
  end;
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   127
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   128
fun extend_tokentrtab tabs tokentrs =
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   129
  let
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   130
    fun ins_tokentr (ts, (m, c, f)) =
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   131
      overwrite (ts, (m, ("_" ^ c, (f, stamp ())) :: assocs ts m));
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   132
  in
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   133
    merge_tokentrtabs tabs (foldl ins_tokentr ([], tokentrs))
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   134
  end;
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   135
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   136
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   137
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   138
(** tables of translation rules **)
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   139
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   140
type ruletab = (Ast.ast * Ast.ast) list Symtab.table;
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   141
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   142
fun dest_ruletab tab = flat (map snd (Symtab.dest tab));
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   143
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   144
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   145
(* lookup_ruletab *)
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   146
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   147
fun lookup_ruletab tab =
4487
9b4c1db5aca1 renamed Symtab.null to Symtab.empty;
wenzelm
parents: 4145
diff changeset
   148
  if Symtab.is_empty tab then None
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   149
  else Some (fn a => Symtab.lookup_multi (tab, a));
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   150
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   151
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   152
(* empty, extend, merge ruletabs *)
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   153
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   154
fun extend_ruletab tab rules =
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   155
  generic_extend (op =) Symtab.dest_multi Symtab.make_multi tab
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   156
    (map (fn r => (Ast.head_of_rule r, r)) (distinct rules));
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   157
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   158
fun merge_ruletabs tab1 tab2 =
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   159
  generic_merge (op =) Symtab.dest_multi Symtab.make_multi tab1 tab2;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   161
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   162
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   163
(** datatype syntax **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   164
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   165
datatype syntax =
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   166
  Syntax of {
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   167
    lexicon: Scan.lexicon,
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
   168
    logtypes: string list,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   169
    gram: Parser.gram,
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   170
    consts: string list,
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   171
    prmodes: string list,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   172
    parse_ast_trtab: ((Ast.ast list -> Ast.ast) * stamp) Symtab.table,
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   173
    parse_ruletab: ruletab,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   174
    parse_trtab: ((term list -> term) * stamp) Symtab.table,
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   175
    print_trtab: ((bool -> typ -> term list -> term) * stamp) list Symtab.table,
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   176
    print_ruletab: ruletab,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   177
    print_ast_trtab: ((Ast.ast list -> Ast.ast) * stamp) list Symtab.table,
6322
7047300264c9 token translation: real;
wenzelm
parents: 6167
diff changeset
   178
    tokentrtab: (string * (string * ((string -> string * real) * stamp)) list) list,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   179
    prtabs: Printer.prtabs}
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   181
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   182
(* empty_syntax *)
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   183
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   184
val empty_syntax =
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   185
  Syntax {
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   186
    lexicon = Scan.empty_lexicon,
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
   187
    logtypes = [],
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   188
    gram = Parser.empty_gram,
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   189
    consts = [],
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   190
    prmodes = [],
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   191
    parse_ast_trtab = Symtab.empty,
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   192
    parse_ruletab = Symtab.empty,
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   193
    parse_trtab = Symtab.empty,
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   194
    print_trtab = Symtab.empty,
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   195
    print_ruletab = Symtab.empty,
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   196
    print_ast_trtab = Symtab.empty,
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   197
    tokentrtab = [],
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   198
    prtabs = Printer.empty_prtabs}
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   199
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   200
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   201
(* extend_syntax *)
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   202
2366
a163d2be1bb5 added chartrans;
wenzelm
parents: 2287
diff changeset
   203
fun extend_syntax (mode, inout) (Syntax tabs) syn_ext =
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   204
  let
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   205
    val {lexicon, logtypes = logtypes1, gram, consts = consts1, prmodes = prmodes1,
2366
a163d2be1bb5 added chartrans;
wenzelm
parents: 2287
diff changeset
   206
      parse_ast_trtab, parse_ruletab, parse_trtab, print_trtab, print_ruletab,
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   207
      print_ast_trtab, tokentrtab, prtabs} = tabs;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   208
    val SynExt.SynExt {logtypes = logtypes2, xprods, consts = consts2, prmodes = prmodes2,
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   209
      parse_ast_translation, parse_rules, parse_translation, print_translation, print_rules,
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   210
      print_ast_translation, token_translation} = syn_ext;
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   211
  in
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   212
    Syntax {
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   213
      lexicon = if inout then Scan.extend_lexicon lexicon (SynExt.delims_of xprods) else lexicon,
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
   214
      logtypes = extend_list logtypes1 logtypes2,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   215
      gram = if inout then Parser.extend_gram gram xprods else gram,
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   216
      consts = consts2 union consts1,
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   217
      prmodes = (mode ins prmodes2) union prmodes1,
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   218
      parse_ast_trtab =
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   219
        extend_trtab parse_ast_trtab parse_ast_translation "parse ast translation",
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   220
      parse_ruletab = extend_ruletab parse_ruletab parse_rules,
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   221
      parse_trtab = extend_trtab parse_trtab parse_translation "parse translation",
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   222
      print_trtab = extend_tr'tab print_trtab print_translation,
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   223
      print_ruletab = extend_ruletab print_ruletab print_rules,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   224
      print_ast_trtab = extend_tr'tab print_ast_trtab print_ast_translation,
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   225
      tokentrtab = extend_tokentrtab tokentrtab token_translation,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   226
      prtabs = Printer.extend_prtabs prtabs mode xprods}
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   227
  end;
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   228
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   229
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   230
(* merge_syntaxes *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   231
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   232
fun merge_syntaxes (Syntax tabs1) (Syntax tabs2) =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   233
  let
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   234
    val {lexicon = lexicon1, logtypes = logtypes1, gram = gram1, consts = consts1,
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   235
      prmodes = prmodes1, parse_ast_trtab = parse_ast_trtab1, parse_ruletab = parse_ruletab1,
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   236
      parse_trtab = parse_trtab1, print_trtab = print_trtab1,
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   237
      print_ruletab = print_ruletab1, print_ast_trtab = print_ast_trtab1,
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   238
      tokentrtab = tokentrtab1, prtabs = prtabs1} = tabs1;
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   239
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   240
    val {lexicon = lexicon2, logtypes = logtypes2, gram = gram2, consts = consts2,
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   241
      prmodes = prmodes2, parse_ast_trtab = parse_ast_trtab2, parse_ruletab = parse_ruletab2,
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   242
      parse_trtab = parse_trtab2, print_trtab = print_trtab2,
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   243
      print_ruletab = print_ruletab2, print_ast_trtab = print_ast_trtab2,
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   244
      tokentrtab = tokentrtab2, prtabs = prtabs2} = tabs2;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   245
  in
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   246
    Syntax {
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   247
      lexicon = Scan.merge_lexicons lexicon1 lexicon2,
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
   248
      logtypes = merge_lists logtypes1 logtypes2,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   249
      gram = Parser.merge_grams gram1 gram2,
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   250
      consts = merge_lists consts1 consts2,
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   251
      prmodes = merge_lists prmodes1 prmodes2,
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   252
      parse_ast_trtab =
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   253
        merge_trtabs parse_ast_trtab1 parse_ast_trtab2 "parse ast translation",
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   254
      parse_ruletab = merge_ruletabs parse_ruletab1 parse_ruletab2,
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   255
      parse_trtab = merge_trtabs parse_trtab1 parse_trtab2 "parse translation",
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   256
      print_trtab = merge_tr'tabs print_trtab1 print_trtab2,
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   257
      print_ruletab = merge_ruletabs print_ruletab1 print_ruletab2,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   258
      print_ast_trtab = merge_tr'tabs print_ast_trtab1 print_ast_trtab2,
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   259
      tokentrtab = merge_tokentrtabs tokentrtab1 tokentrtab2,
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   260
      prtabs = Printer.merge_prtabs prtabs1 prtabs2}
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   261
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   262
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   263
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   264
(* type_syn *)
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   265
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   266
val type_syn = extend_syntax ("", true) empty_syntax TypeExt.type_ext;
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   267
val pure_syn = extend_syntax ("", true) type_syn SynExt.pure_ext;
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   268
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   269
4887
bbc13af86c16 added trfun_names;
wenzelm
parents: 4703
diff changeset
   270
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   271
(** inspect syntax **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   272
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   273
fun pretty_strs_qs name strs =
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   274
  Pretty.strs (name :: map quote (sort_strings strs));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   275
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   276
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   277
(* print_gram *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   278
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   279
fun print_gram (Syntax tabs) =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   280
  let
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   281
    val {lexicon, logtypes, prmodes, gram, prtabs, ...} = tabs;
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   282
    val prmodes' = sort_strings (filter_out (equal "") prmodes);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   283
  in
7025
afbd8241797b tuned dest_lexicon;
wenzelm
parents: 6322
diff changeset
   284
    Pretty.writeln (pretty_strs_qs "lexicon:" (Scan.dest_lexicon lexicon));
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
   285
    Pretty.writeln (Pretty.strs ("logtypes:" :: logtypes));
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   286
    Pretty.writeln (Pretty.big_list "prods:" (Parser.pretty_gram gram));
2913
ce271fa4d8e2 fixed diagnostic output of print modes;
wenzelm
parents: 2706
diff changeset
   287
    Pretty.writeln (pretty_strs_qs "print modes:" prmodes')
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   288
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   289
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   290
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   291
(* print_trans *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   292
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   293
fun print_trans (Syntax tabs) =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   294
  let
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   295
    fun pretty_trtab name tab =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   296
      pretty_strs_qs name (Symtab.keys tab);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   297
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   298
    fun pretty_ruletab name tab =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   299
      Pretty.big_list name (map Ast.pretty_rule (dest_ruletab tab));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   300
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   301
    fun pretty_tokentr (mode, trs) = Pretty.strs (quote mode ^ ":" :: map fst trs);
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   302
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   303
    val {consts, parse_ast_trtab, parse_ruletab, parse_trtab, print_trtab,
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   304
      print_ruletab, print_ast_trtab, tokentrtab, ...} = tabs;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   305
  in
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   306
    Pretty.writeln (pretty_strs_qs "consts:" consts);
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   307
    Pretty.writeln (pretty_trtab "parse_ast_translation:" parse_ast_trtab);
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   308
    Pretty.writeln (pretty_ruletab "parse_rules:" parse_ruletab);
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   309
    Pretty.writeln (pretty_trtab "parse_translation:" parse_trtab);
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   310
    Pretty.writeln (pretty_trtab "print_translation:" print_trtab);
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   311
    Pretty.writeln (pretty_ruletab "print_rules:" print_ruletab);
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   312
    Pretty.writeln (pretty_trtab "print_ast_translation:" print_ast_trtab);
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   313
    Pretty.writeln (Pretty.big_list "token_translation:" (map pretty_tokentr tokentrtab))
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   314
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   315
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   316
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   317
(* print_syntax *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   318
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   319
fun print_syntax syn = (print_gram syn; print_trans syn);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   320
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   321
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   322
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   323
(** read **)
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   324
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   325
(* test_read *)
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   326
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   327
fun test_read (Syntax tabs) root str =
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   328
  let
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   329
    val {lexicon, gram, parse_ast_trtab, parse_ruletab, ...} = tabs;
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   330
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   331
    val chars = Symbol.explode str;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   332
    val toks = Lexicon.tokenize lexicon false chars;
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   333
    val _ = writeln ("tokens: " ^ space_implode " " (map Lexicon.display_token toks));
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   334
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   335
    fun show_pt pt =
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   336
      let
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   337
        val raw_ast = SynTrans.pt_to_ast (K None) pt;
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   338
        val _ = writeln ("raw: " ^ Ast.str_of_ast raw_ast);
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   339
        val pre_ast = SynTrans.pt_to_ast (lookup_tr parse_ast_trtab) pt;
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   340
        val _ = Ast.normalize true true (lookup_ruletab parse_ruletab) pre_ast;
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   341
      in () end;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   342
  in seq show_pt (Parser.parse gram root toks) end;
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   343
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   344
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   345
(* read_ast *)
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   346
882
b118d1ea0dfd moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents: 865
diff changeset
   347
val ambiguity_level = ref 1;
b118d1ea0dfd moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents: 865
diff changeset
   348
865
b38c67991122 added optional precedence for body of binder;
clasohm
parents: 764
diff changeset
   349
fun read_asts (Syntax tabs) xids root str =
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   350
  let
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
   351
    val {lexicon, gram, parse_ast_trtab, logtypes, ...} = tabs;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   352
    val root' = if root mem logtypes then SynExt.logic else root;
4703
a50ab39756db adapted to symbols, scan;
wenzelm
parents: 4618
diff changeset
   353
    val chars = Symbol.explode str;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   354
    val pts = Parser.parse gram root' (Lexicon.tokenize lexicon xids chars);
330
2fda15dd1e0f changed the way a grammar is generated to allow the new parser to work;
clasohm
parents: 260
diff changeset
   355
3739
13f7107676a0 improved warning;
wenzelm
parents: 3526
diff changeset
   356
    fun show_pt pt =
6167
2f354020efc3 corrected output of symbols for several (probably not all) relevant functions
oheimb
parents: 5702
diff changeset
   357
      warning (Symbol.output (Pretty.string_of 
2f354020efc3 corrected output of symbols for several (probably not all) relevant functions
oheimb
parents: 5702
diff changeset
   358
		(Ast.pretty_ast (SynTrans.pt_to_ast (K None) pt))));
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   359
  in
888
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   360
    if length pts > ! ambiguity_level then
6167
2f354020efc3 corrected output of symbols for several (probably not all) relevant functions
oheimb
parents: 5702
diff changeset
   361
      (warning ("Ambiguous input " ^ quote (Symbol.output str));
3526
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   362
       warning "produces the following parse trees:";
882
b118d1ea0dfd moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents: 865
diff changeset
   363
       seq show_pt pts)
624
33b9b5da3e6f made major changes to grammar;
clasohm
parents: 556
diff changeset
   364
    else ();
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   365
    map (SynTrans.pt_to_ast (lookup_tr parse_ast_trtab)) pts
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   366
  end;
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   367
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   368
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   369
(* read *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   370
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   371
fun read (syn as Syntax tabs) ty str =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   372
  let
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   373
    val {parse_ruletab, parse_trtab, ...} = tabs;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   374
    val asts = read_asts syn false (SynExt.typ_to_nonterm ty) str;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   375
  in
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   376
    map (SynTrans.ast_to_term (lookup_tr parse_trtab))
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   377
      (map (Ast.normalize_ast (lookup_ruletab parse_ruletab)) asts)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   378
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   379
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   380
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   381
(* read types *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   382
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
   383
fun read_typ syn get_sort str =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   384
  (case read syn SynExt.typeT str of
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   385
    [t] => TypeExt.typ_of_term (get_sort (TypeExt.raw_term_sorts t)) t
2585
8b92caca102c adapted read_typ, simple_read_typ;
wenzelm
parents: 2504
diff changeset
   386
  | _ => error "read_typ: ambiguous type syntax");
144
0a0da273a6c5 added Syntax.read_typ;
wenzelm
parents: 47
diff changeset
   387
2585
8b92caca102c adapted read_typ, simple_read_typ;
wenzelm
parents: 2504
diff changeset
   388
fun simple_read_typ str =
8b92caca102c adapted read_typ, simple_read_typ;
wenzelm
parents: 2504
diff changeset
   389
  let fun get_sort env xi = if_none (assoc (env, xi)) [] in
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
   390
    read_typ type_syn get_sort str
2585
8b92caca102c adapted read_typ, simple_read_typ;
wenzelm
parents: 2504
diff changeset
   391
  end;
144
0a0da273a6c5 added Syntax.read_typ;
wenzelm
parents: 47
diff changeset
   392
0a0da273a6c5 added Syntax.read_typ;
wenzelm
parents: 47
diff changeset
   393
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   394
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   395
(** prepare translation rules **)
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   396
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   397
datatype 'a trrule =
3526
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   398
  ParseRule of 'a * 'a |
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   399
  PrintRule of 'a * 'a |
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   400
  ParsePrintRule of 'a * 'a;
888
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   401
4618
731bed12f762 export map_trrule;
wenzelm
parents: 4496
diff changeset
   402
fun map_trrule f (ParseRule (x, y)) = ParseRule (f x, f y)
731bed12f762 export map_trrule;
wenzelm
parents: 4496
diff changeset
   403
  | map_trrule f (PrintRule (x, y)) = PrintRule (f x, f y)
731bed12f762 export map_trrule;
wenzelm
parents: 4496
diff changeset
   404
  | map_trrule f (ParsePrintRule (x, y)) = ParsePrintRule (f x, f y);
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   405
3526
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   406
fun parse_rule (ParseRule pats) = Some pats
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   407
  | parse_rule (PrintRule _) = None
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   408
  | parse_rule (ParsePrintRule pats) = Some pats;
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   409
3526
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   410
fun print_rule (ParseRule _) = None
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   411
  | print_rule (PrintRule pats) = Some (swap pats)
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   412
  | print_rule (ParsePrintRule pats) = Some (swap pats);
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   413
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   414
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   415
fun check_rule (rule as (lhs, rhs)) =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   416
  (case Ast.rule_error rule of
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   417
    Some msg =>
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   418
      error ("Error in syntax translation rule: " ^ msg ^ "\n" ^
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   419
        Ast.str_of_ast lhs ^ "  ->  " ^ Ast.str_of_ast rhs)
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   420
  | None => rule);
888
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   421
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   422
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   423
fun read_pattern syn (root, str) =
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   424
  let
237
a7d3e712767a MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents: 175
diff changeset
   425
    val Syntax {consts, ...} = syn;
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   426
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   427
    fun constify (ast as Ast.Constant _) = ast
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   428
      | constify (ast as Ast.Variable x) =
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   429
          if x mem consts orelse NameSpace.qualified x then Ast.Constant x
3830
7797327eca1d constify: qualified is const;
wenzelm
parents: 3782
diff changeset
   430
          else ast
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   431
      | constify (Ast.Appl asts) = Ast.Appl (map constify asts);
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   432
  in
888
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   433
    (case read_asts syn true root str of
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   434
      [ast] => constify ast
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   435
    | _ => error ("Syntactically ambiguous input: " ^ quote str))
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   436
  end handle ERROR =>
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   437
    error ("The error(s) above occurred in translation pattern " ^
3a1de9454d13 improved read_xrules: patterns no longer read twice;
wenzelm
parents: 882
diff changeset
   438
      quote str);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   439
556
3f5f42467717 added type xrule (from sextension.ML);
wenzelm
parents: 383
diff changeset
   440
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   441
fun prep_rules rd_pat raw_rules =
4618
731bed12f762 export map_trrule;
wenzelm
parents: 4496
diff changeset
   442
  let val rules = map (map_trrule rd_pat) raw_rules in
3526
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   443
    (map check_rule (mapfilter parse_rule rules),
df4d0dad2b4e tuned warning;
wenzelm
parents: 2913
diff changeset
   444
      map check_rule (mapfilter print_rule rules))
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   445
  end
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   446
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   447
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   448
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
   449
(** pretty terms, typs, sorts **)
18
c9ec452ff08f lots of internal cleaning and tuning;
wenzelm
parents: 0
diff changeset
   450
6167
2f354020efc3 corrected output of symbols for several (probably not all) relevant functions
oheimb
parents: 5702
diff changeset
   451
val print_mode = print_mode;
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
   452
fun pretty_t t_to_ast prt_t (syn as Syntax tabs) curried t =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   453
  let
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   454
    val {print_trtab, print_ruletab, print_ast_trtab, tokentrtab, prtabs, ...} = tabs;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   455
    val ast = t_to_ast (lookup_tr' print_trtab) t;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   456
  in
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   457
    prt_t curried prtabs (lookup_tr' print_ast_trtab)
6167
2f354020efc3 corrected output of symbols for several (probably not all) relevant functions
oheimb
parents: 5702
diff changeset
   458
      (lookup_tokentr tokentrtab (! print_mode))
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   459
      (Ast.normalize_ast (lookup_ruletab print_ruletab) ast)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   460
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   461
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   462
val pretty_term = pretty_t Printer.term_to_ast Printer.pretty_term_ast;
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   463
fun pretty_typ syn = pretty_t Printer.typ_to_ast Printer.pretty_typ_ast syn false;
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   464
fun pretty_sort syn = pretty_t Printer.sort_to_ast Printer.pretty_typ_ast syn false;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   465
3782
c1b4be0e77cb added simple_str_of_sort;
wenzelm
parents: 3779
diff changeset
   466
val simple_str_of_sort = Pretty.str_of o pretty_sort type_syn;
3779
ce8594f7e0c6 added pretty_sort;
wenzelm
parents: 3739
diff changeset
   467
val simple_string_of_typ = Pretty.string_of o (pretty_typ type_syn);
260
967813b8a7bf added simple_string_of_typ, simple_pprint_typ;
wenzelm
parents: 237
diff changeset
   468
val simple_pprint_typ = Pretty.pprint o Pretty.quote o (pretty_typ type_syn);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   469
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   470
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   471
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   472
(** extend syntax (external interfaces) **)
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   473
2202
cc15a7bfbe12 extend_const_gram now supports multiple disjoint printer tables;
wenzelm
parents: 1813
diff changeset
   474
fun ext_syntax mk_syn_ext prmode (syn as Syntax {logtypes, ...}) decls =
cc15a7bfbe12 extend_const_gram now supports multiple disjoint printer tables;
wenzelm
parents: 1813
diff changeset
   475
  extend_syntax prmode syn (mk_syn_ext logtypes decls);
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   476
167
128e122acc89 added (partial) extend_tables;
wenzelm
parents: 144
diff changeset
   477
764
b60e77395d1a changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents: 624
diff changeset
   478
fun extend_log_types syn logtypes =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   479
  extend_syntax ("", true) syn (SynExt.syn_ext_logtypes logtypes);
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   480
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   481
val extend_type_gram = ext_syntax Mixfix.syn_ext_types ("", true);
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   482
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   483
fun extend_const_gram syn prmode = ext_syntax Mixfix.syn_ext_consts prmode syn;
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   484
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   485
val extend_consts = ext_syntax SynExt.syn_ext_const_names ("", true);
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   486
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   487
val extend_trfuns = ext_syntax SynExt.syn_ext_trfuns ("", true);
383
fcea89074e4c added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents: 330
diff changeset
   488
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   489
val extend_trfunsT = ext_syntax SynExt.syn_ext_trfunsT ("", true);
2383
4127499d9b52 added extend_trfunsT;
wenzelm
parents: 2366
diff changeset
   490
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   491
val extend_tokentrfuns = ext_syntax SynExt.syn_ext_tokentrfuns ("", true);
2700
80e6b48c5204 added token translation support;
wenzelm
parents: 2585
diff changeset
   492
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   493
fun extend_trrules syn rules =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   494
  ext_syntax SynExt.syn_ext_rules ("", true) syn (prep_rules (read_pattern syn) rules);
1158
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   495
96804ce95516 added extend_trrules_i;
wenzelm
parents: 1147
diff changeset
   496
fun extend_trrules_i syn rules =
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   497
  ext_syntax SynExt.syn_ext_rules ("", true) syn (prep_rules I rules);
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   498
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   499
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   500
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   501
(** export parts of internal Syntax structures **)
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   502
6322
7047300264c9 token translation: real;
wenzelm
parents: 6167
diff changeset
   503
open TokenTrans Lexicon SynExt Ast Parser TypeExt SynTrans Mixfix Printer;
2366
a163d2be1bb5 added chartrans;
wenzelm
parents: 2287
diff changeset
   504
a163d2be1bb5 added chartrans;
wenzelm
parents: 2287
diff changeset
   505
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   506
end;
5692
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   507
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   508
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   509
structure BasicSyntax: BASIC_SYNTAX = Syntax;
2e873c5f0e2c no open;
wenzelm
parents: 4887
diff changeset
   510
open BasicSyntax;