author | berghofe |
Fri, 15 Mar 1996 12:01:19 +0100 | |
changeset 1580 | e3fd931e6095 |
parent 1511 | 09354d37a5ab |
child 1813 | 23bda45846a2 |
permissions | -rw-r--r-- |
18 | 1 |
(* Title: Pure/Syntax/syntax.ML |
0 | 2 |
ID: $Id$ |
3 |
Author: Tobias Nipkow and Markus Wenzel, TU Muenchen |
|
18 | 4 |
|
5 |
Root of Isabelle's syntax module. |
|
0 | 6 |
*) |
7 |
||
556 | 8 |
infix |-> <-| <->; |
9 |
||
260 | 10 |
signature BASIC_SYNTAX = |
1511 | 11 |
sig |
260 | 12 |
include AST0 |
556 | 13 |
include SYN_TRANS0 |
14 |
include MIXFIX0 |
|
260 | 15 |
include PRINTER0 |
1158 | 16 |
datatype 'a trrule = |
17 |
op |-> of 'a * 'a | |
|
18 |
op <-| of 'a * 'a | |
|
19 |
op <-> of 'a * 'a |
|
1511 | 20 |
end; |
260 | 21 |
|
0 | 22 |
signature SYNTAX = |
1511 | 23 |
sig |
260 | 24 |
include AST1 |
0 | 25 |
include LEXICON0 |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
26 |
include SYN_EXT0 |
0 | 27 |
include TYPE_EXT0 |
556 | 28 |
include SYN_TRANS1 |
29 |
include MIXFIX1 |
|
0 | 30 |
include PRINTER0 |
1158 | 31 |
datatype 'a trrule = |
32 |
op |-> of 'a * 'a | |
|
33 |
op <-| of 'a * 'a | |
|
34 |
op <-> of 'a * 'a |
|
556 | 35 |
type syntax |
36 |
val extend_log_types: syntax -> string list -> syntax |
|
37 |
val extend_type_gram: syntax -> (string * int * mixfix) list -> syntax |
|
38 |
val extend_const_gram: syntax -> (string * typ * mixfix) list -> syntax |
|
39 |
val extend_consts: syntax -> string list -> syntax |
|
40 |
val extend_trfuns: syntax -> |
|
41 |
(string * (ast list -> ast)) list * |
|
42 |
(string * (term list -> term)) list * |
|
43 |
(string * (term list -> term)) list * |
|
44 |
(string * (ast list -> ast)) list -> syntax |
|
1158 | 45 |
val extend_trrules: syntax -> (string * string) trrule list -> syntax |
46 |
val extend_trrules_i: syntax -> ast trrule list -> syntax |
|
556 | 47 |
val merge_syntaxes: syntax -> syntax -> syntax |
48 |
val type_syn: syntax |
|
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
49 |
val pure_syn: syntax |
556 | 50 |
val print_gram: syntax -> unit |
51 |
val print_trans: syntax -> unit |
|
52 |
val print_syntax: syntax -> unit |
|
53 |
val test_read: syntax -> string -> string -> unit |
|
624 | 54 |
val read: syntax -> typ -> string -> term list |
556 | 55 |
val read_typ: syntax -> (indexname -> sort) -> string -> typ |
56 |
val simple_read_typ: string -> typ |
|
922
196ca0973a6d
added CPure (curried functions) and ProtoPure (ancestor of Pure and CPure)
clasohm
parents:
888
diff
changeset
|
57 |
val pretty_term: bool -> syntax -> term -> Pretty.T |
556 | 58 |
val pretty_typ: syntax -> typ -> Pretty.T |
922
196ca0973a6d
added CPure (curried functions) and ProtoPure (ancestor of Pure and CPure)
clasohm
parents:
888
diff
changeset
|
59 |
val string_of_term: bool -> syntax -> term -> string |
556 | 60 |
val string_of_typ: syntax -> typ -> string |
61 |
val simple_string_of_typ: typ -> string |
|
62 |
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
|
63 |
val ambiguity_level: int ref |
1511 | 64 |
end; |
0 | 65 |
|
1511 | 66 |
structure Syntax : SYNTAX = |
0 | 67 |
struct |
68 |
||
1511 | 69 |
open Lexicon SynExt Ast Parser TypeExt SynTrans Mixfix Printer; |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
70 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
71 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
72 |
(** tables of translation functions **) |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
73 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
74 |
(*the ref serves as unique id*) |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
75 |
type 'a trtab = (('a list -> 'a) * unit ref) Symtab.table; |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
76 |
|
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
77 |
val dest_trtab = Symtab.dest; |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
78 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
79 |
fun lookup_trtab tab c = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
80 |
apsome fst (Symtab.lookup (tab, c)); |
0 | 81 |
|
82 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
83 |
(* empty, extend, merge trtabs *) |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
84 |
|
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
85 |
fun err_dup_trfuns name cs = |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
86 |
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
|
87 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
88 |
val empty_trtab = Symtab.null; |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
89 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
90 |
fun extend_trtab tab trfuns name = |
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
91 |
Symtab.extend_new (tab, map (fn (c, f) => (c, (f, ref ()))) trfuns) |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
92 |
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
|
93 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
94 |
fun merge_trtabs tab1 tab2 name = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
95 |
Symtab.merge eq_snd (tab1, tab2) |
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
96 |
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
|
97 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
98 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
99 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
100 |
(** tables of translation rules **) |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
101 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
102 |
type ruletab = (ast * ast) list Symtab.table; |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
103 |
|
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
104 |
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
|
105 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
106 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
107 |
(* lookup_ruletab *) |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
108 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
109 |
fun lookup_ruletab tab = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
110 |
if Symtab.is_null tab then None |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
111 |
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
|
112 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
113 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
114 |
(* empty, extend, merge ruletabs *) |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
115 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
116 |
val empty_ruletab = Symtab.null; |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
117 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
118 |
fun extend_ruletab tab rules = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
119 |
generic_extend (op =) Symtab.dest_multi Symtab.make_multi tab |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
120 |
(map (fn r => (head_of_rule r, r)) (distinct rules)); |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
121 |
|
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
122 |
fun merge_ruletabs tab1 tab2 = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
123 |
generic_merge (op =) Symtab.dest_multi Symtab.make_multi tab1 tab2; |
0 | 124 |
|
125 |
||
126 |
||
127 |
(** datatype syntax **) |
|
128 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
129 |
datatype syntax = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
130 |
Syntax of { |
18 | 131 |
lexicon: lexicon, |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
132 |
logtypes: string list, |
18 | 133 |
gram: gram, |
134 |
consts: string list, |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
135 |
parse_ast_trtab: ast trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
136 |
parse_ruletab: ruletab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
137 |
parse_trtab: term trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
138 |
print_trtab: term trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
139 |
print_ruletab: ruletab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
140 |
print_ast_trtab: ast trtab, |
18 | 141 |
prtab: prtab}; |
0 | 142 |
|
18 | 143 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
144 |
(* empty_syntax *) |
18 | 145 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
146 |
val empty_syntax = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
147 |
Syntax { |
167 | 148 |
lexicon = empty_lexicon, |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
149 |
logtypes = [], |
171 | 150 |
gram = empty_gram, |
167 | 151 |
consts = [], |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
152 |
parse_ast_trtab = empty_trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
153 |
parse_ruletab = empty_ruletab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
154 |
parse_trtab = empty_trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
155 |
print_trtab = empty_trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
156 |
print_ruletab = empty_ruletab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
157 |
print_ast_trtab = empty_trtab, |
167 | 158 |
prtab = empty_prtab}; |
159 |
||
160 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
161 |
(* extend_syntax *) |
167 | 162 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
163 |
fun extend_syntax (Syntax tabs) syn_ext = |
167 | 164 |
let |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
165 |
val {lexicon, logtypes = logtypes1, gram, consts = consts1, parse_ast_trtab, |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
166 |
parse_ruletab, parse_trtab, print_trtab, print_ruletab, print_ast_trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
167 |
prtab} = tabs; |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
168 |
val SynExt {logtypes = logtypes2, xprods, consts = consts2, parse_ast_translation, |
167 | 169 |
parse_rules, parse_translation, print_translation, print_rules, |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
170 |
print_ast_translation} = syn_ext; |
167 | 171 |
in |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
172 |
Syntax { |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
173 |
lexicon = extend_lexicon lexicon (delims_of xprods), |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
174 |
logtypes = extend_list logtypes1 logtypes2, |
1147
57b5f55bf879
removed 'raw' productions from gram datatype; replaced mk_gram by add_prods;
clasohm
parents:
922
diff
changeset
|
175 |
gram = extend_gram gram xprods, |
167 | 176 |
consts = consts2 union consts1, |
177 |
parse_ast_trtab = |
|
178 |
extend_trtab parse_ast_trtab parse_ast_translation "parse ast translation", |
|
179 |
parse_ruletab = extend_ruletab parse_ruletab parse_rules, |
|
180 |
parse_trtab = extend_trtab parse_trtab parse_translation "parse translation", |
|
181 |
print_trtab = extend_trtab print_trtab print_translation "print translation", |
|
182 |
print_ruletab = extend_ruletab print_ruletab print_rules, |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
183 |
print_ast_trtab = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
184 |
extend_trtab print_ast_trtab print_ast_translation "print ast translation", |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
185 |
prtab = extend_prtab prtab xprods} |
18 | 186 |
end; |
187 |
||
188 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
189 |
(* merge_syntaxes *) |
0 | 190 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
191 |
fun merge_syntaxes (Syntax tabs1) (Syntax tabs2) = |
0 | 192 |
let |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
193 |
val {lexicon = lexicon1, logtypes = logtypes1, gram = gram1, consts = consts1, |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
194 |
parse_ast_trtab = parse_ast_trtab1, parse_ruletab = parse_ruletab1, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
195 |
parse_trtab = parse_trtab1, print_trtab = print_trtab1, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
196 |
print_ruletab = print_ruletab1, print_ast_trtab = print_ast_trtab1, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
197 |
prtab = prtab1} = tabs1; |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
198 |
|
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
199 |
val {lexicon = lexicon2, logtypes = logtypes2, gram = gram2, consts = consts2, |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
200 |
parse_ast_trtab = parse_ast_trtab2, parse_ruletab = parse_ruletab2, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
201 |
parse_trtab = parse_trtab2, print_trtab = print_trtab2, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
202 |
print_ruletab = print_ruletab2, print_ast_trtab = print_ast_trtab2, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
203 |
prtab = prtab2} = tabs2; |
0 | 204 |
in |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
205 |
Syntax { |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
206 |
lexicon = merge_lexicons lexicon1 lexicon2, |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
207 |
logtypes = merge_lists logtypes1 logtypes2, |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
208 |
gram = merge_grams gram1 gram2, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
209 |
consts = merge_lists consts1 consts2, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
210 |
parse_ast_trtab = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
211 |
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
|
212 |
parse_ruletab = merge_ruletabs parse_ruletab1 parse_ruletab2, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
213 |
parse_trtab = merge_trtabs parse_trtab1 parse_trtab2 "parse translation", |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
214 |
print_trtab = merge_trtabs print_trtab1 print_trtab2 "print translation", |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
215 |
print_ruletab = merge_ruletabs print_ruletab1 print_ruletab2, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
216 |
print_ast_trtab = |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
217 |
merge_trtabs print_ast_trtab1 print_ast_trtab2 "print ast translation", |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
218 |
prtab = merge_prtabs prtab1 prtab2} |
0 | 219 |
end; |
220 |
||
221 |
||
260 | 222 |
(* type_syn *) |
223 |
||
224 |
val type_syn = extend_syntax empty_syntax type_ext; |
|
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
225 |
val pure_syn = extend_syntax type_syn pure_ext; |
260 | 226 |
|
0 | 227 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
228 |
(** inspect syntax **) |
0 | 229 |
|
260 | 230 |
fun pretty_strs_qs name strs = |
231 |
Pretty.strs (name :: map quote (sort_strings strs)); |
|
0 | 232 |
|
18 | 233 |
|
234 |
(* print_gram *) |
|
0 | 235 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
236 |
fun print_gram (Syntax tabs) = |
0 | 237 |
let |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
238 |
val {lexicon, logtypes, gram, ...} = tabs; |
0 | 239 |
in |
260 | 240 |
Pretty.writeln (pretty_strs_qs "lexicon:" (dest_lexicon lexicon)); |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
241 |
Pretty.writeln (Pretty.strs ("logtypes:" :: logtypes)); |
260 | 242 |
Pretty.writeln (Pretty.big_list "prods:" (pretty_gram gram)) |
0 | 243 |
end; |
244 |
||
245 |
||
18 | 246 |
(* print_trans *) |
0 | 247 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
248 |
fun print_trans (Syntax tabs) = |
0 | 249 |
let |
260 | 250 |
fun pretty_trtab name tab = |
251 |
pretty_strs_qs name (map fst (dest_trtab tab)); |
|
0 | 252 |
|
260 | 253 |
fun pretty_ruletab name tab = |
254 |
Pretty.big_list name (map pretty_rule (dest_ruletab tab)); |
|
0 | 255 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
256 |
val {consts, parse_ast_trtab, parse_ruletab, parse_trtab, print_trtab, |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
257 |
print_ruletab, print_ast_trtab, ...} = tabs; |
0 | 258 |
in |
260 | 259 |
Pretty.writeln (pretty_strs_qs "consts:" consts); |
260 |
Pretty.writeln (pretty_trtab "parse_ast_translation:" parse_ast_trtab); |
|
261 |
Pretty.writeln (pretty_ruletab "parse_rules:" parse_ruletab); |
|
262 |
Pretty.writeln (pretty_trtab "parse_translation:" parse_trtab); |
|
263 |
Pretty.writeln (pretty_trtab "print_translation:" print_trtab); |
|
264 |
Pretty.writeln (pretty_ruletab "print_rules:" print_ruletab); |
|
265 |
Pretty.writeln (pretty_trtab "print_ast_translation:" print_ast_trtab) |
|
0 | 266 |
end; |
267 |
||
268 |
||
269 |
(* print_syntax *) |
|
270 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
271 |
fun print_syntax syn = (print_gram syn; print_trans syn); |
0 | 272 |
|
273 |
||
274 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
275 |
(** read **) |
18 | 276 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
277 |
(* test_read *) |
18 | 278 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
279 |
fun test_read (Syntax tabs) root str = |
18 | 280 |
let |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
281 |
val {lexicon, gram, parse_ast_trtab, parse_ruletab, ...} = tabs; |
18 | 282 |
|
283 |
val toks = tokenize lexicon false str; |
|
624 | 284 |
val _ = writeln ("tokens: " ^ space_implode " " (map display_token toks)); |
18 | 285 |
|
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
286 |
fun show_pt pt = |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
287 |
let |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
288 |
val raw_ast = pt_to_ast (K None) pt; |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
289 |
val _ = writeln ("raw: " ^ str_of_ast raw_ast); |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
290 |
val pre_ast = pt_to_ast (lookup_trtab parse_ast_trtab) pt; |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
291 |
val _ = normalize true true (lookup_ruletab parse_ruletab) pre_ast; |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
292 |
in () end; |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
293 |
in |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
294 |
seq show_pt (parse gram root toks) |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
295 |
end; |
18 | 296 |
|
297 |
||
260 | 298 |
(* read_ast *) |
299 |
||
882
b118d1ea0dfd
moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents:
865
diff
changeset
|
300 |
val ambiguity_level = ref 1; |
b118d1ea0dfd
moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents:
865
diff
changeset
|
301 |
|
865 | 302 |
fun read_asts (Syntax tabs) xids root str = |
260 | 303 |
let |
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
304 |
val {lexicon, gram, parse_ast_trtab, logtypes, ...} = tabs; |
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
305 |
val root' = if root mem logtypes then logic else root; |
624 | 306 |
val pts = parse gram root' (tokenize lexicon xids str); |
330
2fda15dd1e0f
changed the way a grammar is generated to allow the new parser to work;
clasohm
parents:
260
diff
changeset
|
307 |
|
624 | 308 |
fun show_pt pt = writeln (str_of_ast (pt_to_ast (K None) pt)); |
260 | 309 |
in |
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
310 |
if length pts > ! ambiguity_level then |
1580
e3fd931e6095
Added some functions which allow redirection of Isabelle's output
berghofe
parents:
1511
diff
changeset
|
311 |
(warning ("Ambiguous input " ^ quote str); |
882
b118d1ea0dfd
moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents:
865
diff
changeset
|
312 |
writeln "produces the following parse trees:"; |
b118d1ea0dfd
moved ambiguity_level from sign.ML to Syntax/syntax.ML
clasohm
parents:
865
diff
changeset
|
313 |
seq show_pt pts) |
624 | 314 |
else (); |
315 |
map (pt_to_ast (lookup_trtab parse_ast_trtab)) pts |
|
260 | 316 |
end; |
317 |
||
318 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
319 |
(* read *) |
0 | 320 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
321 |
fun read (syn as Syntax tabs) ty str = |
0 | 322 |
let |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
323 |
val {parse_ruletab, parse_trtab, ...} = tabs; |
865 | 324 |
val asts = read_asts syn false (typ_to_nonterm ty) str; |
0 | 325 |
in |
624 | 326 |
map (ast_to_term (lookup_trtab parse_trtab)) |
327 |
(map (normalize_ast (lookup_ruletab parse_ruletab)) asts) |
|
0 | 328 |
end; |
329 |
||
330 |
||
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
331 |
(* read types *) |
0 | 332 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
333 |
fun read_typ syn def_sort str = |
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
334 |
(case read syn typeT str of |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
335 |
[t] => typ_of_term (raw_term_sorts t) def_sort t |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
336 |
| _ => sys_error "read_typ: ambiguous type syntax"); |
144 | 337 |
|
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
338 |
fun simple_read_typ str = read_typ type_syn (K []) str; |
144 | 339 |
|
340 |
||
18 | 341 |
|
1158 | 342 |
(** prepare translation rules **) |
343 |
||
344 |
datatype 'a trrule = |
|
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
345 |
op |-> of 'a * 'a | |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
346 |
op <-| of 'a * 'a | |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
347 |
op <-> of 'a * 'a; |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
348 |
|
1158 | 349 |
fun map_rule f (x |-> y) = (f x |-> f y) |
350 |
| map_rule f (x <-| y) = (f x <-| f y) |
|
351 |
| map_rule f (x <-> y) = (f x <-> f y); |
|
352 |
||
353 |
fun right_rule (pat1 |-> pat2) = Some (pat1, pat2) |
|
354 |
| right_rule (pat1 <-| pat2) = None |
|
355 |
| right_rule (pat1 <-> pat2) = Some (pat1, pat2); |
|
356 |
||
357 |
fun left_rule (pat1 |-> pat2) = None |
|
358 |
| left_rule (pat1 <-| pat2) = Some (pat2, pat1) |
|
359 |
| left_rule (pat1 <-> pat2) = Some (pat2, pat1); |
|
360 |
||
361 |
||
362 |
fun check_rule (rule as (lhs, rhs)) = |
|
363 |
(case rule_error rule of |
|
364 |
Some msg => |
|
365 |
error ("Error in syntax translation rule: " ^ msg ^ "\n" ^ |
|
366 |
str_of_ast lhs ^ " -> " ^ str_of_ast rhs) |
|
367 |
| None => rule); |
|
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
368 |
|
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
369 |
|
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
370 |
fun read_pattern syn (root, str) = |
18 | 371 |
let |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
372 |
val Syntax {consts, ...} = syn; |
18 | 373 |
|
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
374 |
fun constify (ast as Constant _) = ast |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
375 |
| constify (ast as Variable x) = |
18 | 376 |
if x mem consts then Constant x else ast |
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
377 |
| constify (Appl asts) = Appl (map constify asts); |
18 | 378 |
in |
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
379 |
(case read_asts syn true root str of |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
380 |
[ast] => constify ast |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
381 |
| _ => error ("Syntactically ambiguous input: " ^ quote str)) |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
382 |
end handle ERROR => |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
383 |
error ("The error(s) above occurred in translation pattern " ^ |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
384 |
quote str); |
0 | 385 |
|
556 | 386 |
|
1158 | 387 |
fun prep_rules rd_pat raw_rules = |
388 |
let val rules = map (map_rule rd_pat) raw_rules in |
|
888
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
389 |
(map check_rule (mapfilter right_rule rules), |
3a1de9454d13
improved read_xrules: patterns no longer read twice;
wenzelm
parents:
882
diff
changeset
|
390 |
map check_rule (mapfilter left_rule rules)) |
1158 | 391 |
end |
18 | 392 |
|
393 |
||
394 |
||
395 |
(** pretty terms or typs **) |
|
396 |
||
922
196ca0973a6d
added CPure (curried functions) and ProtoPure (ancestor of Pure and CPure)
clasohm
parents:
888
diff
changeset
|
397 |
fun pretty_t t_to_ast pretty_t curried (syn as Syntax tabs) t = |
0 | 398 |
let |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
399 |
val {print_trtab, print_ruletab, print_ast_trtab, prtab, ...} = tabs; |
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
400 |
val ast = t_to_ast (lookup_trtab print_trtab) t; |
0 | 401 |
in |
922
196ca0973a6d
added CPure (curried functions) and ProtoPure (ancestor of Pure and CPure)
clasohm
parents:
888
diff
changeset
|
402 |
pretty_t curried prtab (lookup_trtab print_ast_trtab) |
237
a7d3e712767a
MAJOR INTERNAL CHANGE: extend and merge operations of syntax tables
wenzelm
parents:
175
diff
changeset
|
403 |
(normalize_ast (lookup_ruletab print_ruletab) ast) |
0 | 404 |
end; |
405 |
||
406 |
val pretty_term = pretty_t term_to_ast pretty_term_ast; |
|
922
196ca0973a6d
added CPure (curried functions) and ProtoPure (ancestor of Pure and CPure)
clasohm
parents:
888
diff
changeset
|
407 |
val pretty_typ = pretty_t typ_to_ast pretty_typ_ast false; |
0 | 408 |
|
922
196ca0973a6d
added CPure (curried functions) and ProtoPure (ancestor of Pure and CPure)
clasohm
parents:
888
diff
changeset
|
409 |
fun string_of_term curried syn t = |
196ca0973a6d
added CPure (curried functions) and ProtoPure (ancestor of Pure and CPure)
clasohm
parents:
888
diff
changeset
|
410 |
Pretty.string_of (pretty_term curried syn t); |
260 | 411 |
fun string_of_typ syn ty = Pretty.string_of (pretty_typ syn ty); |
0 | 412 |
|
260 | 413 |
val simple_string_of_typ = string_of_typ type_syn; |
414 |
val simple_pprint_typ = Pretty.pprint o Pretty.quote o (pretty_typ type_syn); |
|
0 | 415 |
|
416 |
||
417 |
||
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
418 |
(** extend syntax (external interfaces) **) |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
419 |
|
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
420 |
fun ext_syntax mk_syn_ext (syn as Syntax {logtypes, ...}) decls = |
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
421 |
extend_syntax syn (mk_syn_ext logtypes decls); |
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
422 |
|
167 | 423 |
|
764
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
424 |
fun extend_log_types syn logtypes = |
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
clasohm
parents:
624
diff
changeset
|
425 |
extend_syntax syn (syn_ext_logtypes logtypes); |
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
426 |
|
556 | 427 |
val extend_type_gram = ext_syntax syn_ext_types; |
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
428 |
|
556 | 429 |
val extend_const_gram = ext_syntax syn_ext_consts; |
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
430 |
|
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
431 |
val extend_consts = ext_syntax syn_ext_const_names; |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
432 |
|
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
433 |
val extend_trfuns = ext_syntax syn_ext_trfuns; |
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
434 |
|
1158 | 435 |
fun extend_trrules syn rules = |
436 |
ext_syntax syn_ext_rules syn (prep_rules (read_pattern syn) rules); |
|
437 |
||
438 |
fun extend_trrules_i syn rules = |
|
439 |
ext_syntax syn_ext_rules syn (prep_rules I rules); |
|
383
fcea89074e4c
added incremental extension functions: extend_log_types, extend_type_gram,
wenzelm
parents:
330
diff
changeset
|
440 |
|
0 | 441 |
end; |