| author | lcp | 
| Mon, 27 Feb 1995 18:07:59 +0100 | |
| changeset 914 | cae574c09137 | 
| parent 911 | 55754d6d399c | 
| child 922 | 196ca0973a6d | 
| permissions | -rw-r--r-- | 
| 240 | 1 | (* Title: Pure/Syntax/syn_ext.ML | 
| 2 | ID: $Id$ | |
| 911 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 3 | Author: Markus Wenzel and Carsten Clasohm, TU Muenchen | 
| 240 | 4 | |
| 5 | Syntax extension (internal interface). | |
| 6 | *) | |
| 7 | ||
| 8 | signature SYN_EXT0 = | |
| 9 | sig | |
| 10 | val typeT: typ | |
| 11 | val constrainC: string | |
| 12 | end; | |
| 13 | ||
| 14 | signature SYN_EXT = | |
| 15 | sig | |
| 16 | include SYN_EXT0 | |
| 17 | structure Ast: AST | |
| 18 | local open Ast in | |
| 19 | val logic: string | |
| 20 | val args: string | |
| 780 | 21 | val any: string | 
| 22 | val sprop: string | |
| 240 | 23 | val applC: string | 
| 24 | val typ_to_nonterm: typ -> string | |
| 25 | datatype xsymb = | |
| 26 | Delim of string | | |
| 27 | Argument of string * int | | |
| 28 | Space of string | | |
| 29 | Bg of int | Brk of int | En | |
| 30 | datatype xprod = XProd of string * xsymb list * string * int | |
| 31 | val max_pri: int | |
| 32 | val chain_pri: int | |
| 33 | val delims_of: xprod list -> string list | |
| 34 | datatype mfix = Mfix of string * typ * string * int list * int | |
| 35 | datatype syn_ext = | |
| 36 |       SynExt of {
 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 37 | logtypes: string list, | 
| 240 | 38 | xprods: xprod list, | 
| 39 | consts: string list, | |
| 40 | parse_ast_translation: (string * (ast list -> ast)) list, | |
| 41 | parse_rules: (ast * ast) list, | |
| 42 | parse_translation: (string * (term list -> term)) list, | |
| 43 | print_translation: (string * (term list -> term)) list, | |
| 44 | print_rules: (ast * ast) list, | |
| 45 | print_ast_translation: (string * (ast list -> ast)) list} | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 46 | val mk_syn_ext: bool -> string list -> mfix list -> | 
| 780 | 47 | string list -> (string * (ast list -> ast)) list * | 
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 48 | (string * (term list -> term)) list * | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 49 | (string * (term list -> term)) list * (string * (ast list -> ast)) list | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 50 | -> (ast * ast) list * (ast * ast) list -> syn_ext | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 51 | val syn_ext: string list -> mfix list -> string list -> | 
| 240 | 52 | (string * (ast list -> ast)) list * (string * (term list -> term)) list * | 
| 53 | (string * (term list -> term)) list * (string * (ast list -> ast)) list | |
| 54 | -> (ast * ast) list * (ast * ast) list -> syn_ext | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 55 | val syn_ext_logtypes: string list -> syn_ext | 
| 555 
a7f397a14b16
removed idT, varT, tidT, tvarT (now in lexicon.ML);
 wenzelm parents: 
441diff
changeset | 56 | val syn_ext_const_names: string list -> string list -> syn_ext | 
| 330 
2fda15dd1e0f
changed the way a grammar is generated to allow the new parser to work;
 clasohm parents: 
240diff
changeset | 57 | val syn_ext_rules: string list -> (ast * ast) list * (ast * ast) list -> syn_ext | 
| 555 
a7f397a14b16
removed idT, varT, tidT, tvarT (now in lexicon.ML);
 wenzelm parents: 
441diff
changeset | 58 | val syn_ext_trfuns: string list -> | 
| 
a7f397a14b16
removed idT, varT, tidT, tvarT (now in lexicon.ML);
 wenzelm parents: 
441diff
changeset | 59 | (string * (ast list -> ast)) list * (string * (term list -> term)) list * | 
| 
a7f397a14b16
removed idT, varT, tidT, tvarT (now in lexicon.ML);
 wenzelm parents: 
441diff
changeset | 60 | (string * (term list -> term)) list * (string * (ast list -> ast)) list | 
| 
a7f397a14b16
removed idT, varT, tidT, tvarT (now in lexicon.ML);
 wenzelm parents: 
441diff
changeset | 61 | -> syn_ext | 
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 62 | val pure_ext: syn_ext | 
| 240 | 63 | end | 
| 64 | end; | |
| 65 | ||
| 66 | functor SynExtFun(structure Lexicon: LEXICON and Ast: AST): SYN_EXT = | |
| 67 | struct | |
| 68 | ||
| 69 | structure Ast = Ast; | |
| 70 | open Lexicon Ast; | |
| 71 | ||
| 72 | ||
| 73 | (** misc definitions **) | |
| 74 | ||
| 75 | (* syntactic categories *) | |
| 76 | ||
| 77 | val logic = "logic"; | |
| 78 | val logicT = Type (logic, []); | |
| 79 | ||
| 80 | val args = "args"; | |
| 81 | val argsT = Type (args, []); | |
| 82 | ||
| 330 
2fda15dd1e0f
changed the way a grammar is generated to allow the new parser to work;
 clasohm parents: 
240diff
changeset | 83 | val typeT = Type ("type", []);
 | 
| 240 | 84 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 85 | val sprop = "#prop"; | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 86 | val spropT = Type (sprop, []); | 
| 240 | 87 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 88 | val any = "any"; | 
| 624 | 89 | val anyT = Type (any, []); | 
| 90 | ||
| 780 | 91 | |
| 240 | 92 | (* constants *) | 
| 93 | ||
| 94 | val applC = "_appl"; | |
| 95 | val constrainC = "_constrain"; | |
| 96 | ||
| 97 | ||
| 98 | ||
| 99 | (** datatype xprod **) | |
| 100 | ||
| 101 | (*Delim s: delimiter s | |
| 102 | Argument (s, p): nonterminal s requiring priority >= p, or valued token | |
| 103 | Space s: some white space for printing | |
| 104 | Bg, Brk, En: blocks and breaks for pretty printing*) | |
| 105 | ||
| 106 | datatype xsymb = | |
| 107 | Delim of string | | |
| 108 | Argument of string * int | | |
| 109 | Space of string | | |
| 110 | Bg of int | Brk of int | En; | |
| 111 | ||
| 112 | ||
| 113 | (*XProd (lhs, syms, c, p): | |
| 114 | lhs: name of nonterminal on the lhs of the production | |
| 115 | syms: list of symbols on the rhs of the production | |
| 116 | c: head of parse tree | |
| 117 | p: priority of this production*) | |
| 118 | ||
| 119 | datatype xprod = XProd of string * xsymb list * string * int; | |
| 120 | ||
| 121 | val max_pri = 1000; (*maximum legal priority*) | |
| 122 | val chain_pri = ~1; (*dummy for chain productions*) | |
| 123 | ||
| 124 | ||
| 125 | (* delims_of *) | |
| 126 | ||
| 127 | fun delims_of xprods = | |
| 128 | let | |
| 129 | fun del_of (Delim s) = Some s | |
| 130 | | del_of _ = None; | |
| 131 | ||
| 132 | fun dels_of (XProd (_, xsymbs, _, _)) = | |
| 133 | mapfilter del_of xsymbs; | |
| 134 | in | |
| 135 | distinct (flat (map dels_of xprods)) | |
| 136 | end; | |
| 137 | ||
| 138 | ||
| 139 | ||
| 140 | (** datatype mfix **) | |
| 141 | ||
| 142 | (*Mfix (sy, ty, c, ps, p): | |
| 143 | sy: rhs of production as symbolic string | |
| 144 | ty: type description of production | |
| 145 | c: head of parse tree | |
| 146 | ps: priorities of arguments in sy | |
| 147 | p: priority of production*) | |
| 148 | ||
| 149 | datatype mfix = Mfix of string * typ * string * int list * int; | |
| 150 | ||
| 151 | ||
| 152 | (* typ_to_nonterm *) | |
| 153 | ||
| 865 | 154 | fun typ_to_nt _ (Type (c, _)) = c | 
| 155 | | typ_to_nt default _ = default; | |
| 156 | ||
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 157 | (*get nonterminal for rhs*) | 
| 865 | 158 | val typ_to_nonterm = typ_to_nt any; | 
| 240 | 159 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 160 | (*get nonterminal for lhs*) | 
| 865 | 161 | val typ_to_nonterm1 = typ_to_nt logic; | 
| 240 | 162 | |
| 163 | ||
| 164 | (* mfix_to_xprod *) | |
| 165 | ||
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 166 | fun mfix_to_xprod convert logtypes (Mfix (sy, typ, const, pris, pri)) = | 
| 240 | 167 | let | 
| 168 | fun err msg = | |
| 780 | 169 |       (writeln ("Error in mixfix annotation " ^ quote sy ^ " for "
 | 
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 170 | ^ quote const); | 
| 240 | 171 | error msg); | 
| 172 | ||
| 173 | fun check_pri p = | |
| 174 | if p >= 0 andalso p <= max_pri then () | |
| 175 |       else err ("precedence out of range: " ^ string_of_int p);
 | |
| 176 | ||
| 177 | fun blocks_ok [] 0 = true | |
| 178 | | blocks_ok [] _ = false | |
| 179 | | blocks_ok (Bg _ :: syms) n = blocks_ok syms (n + 1) | |
| 180 | | blocks_ok (En :: _) 0 = false | |
| 181 | | blocks_ok (En :: syms) n = blocks_ok syms (n - 1) | |
| 182 | | blocks_ok (_ :: syms) n = blocks_ok syms n; | |
| 183 | ||
| 184 | fun check_blocks syms = | |
| 185 | if blocks_ok syms 0 then () | |
| 186 | else err "unbalanced block parentheses"; | |
| 187 | ||
| 188 | ||
| 911 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 189 | local | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 190 |       fun is_meta c = c mem ["(", ")", "/", "_"];
 | 
| 240 | 191 | |
| 911 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 192 |       fun scan_delim_char ("'" :: c :: cs) =
 | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 193 | if is_blank c then raise LEXICAL_ERROR else (c, cs) | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 194 | | scan_delim_char ["'"] = err "trailing escape character" | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 195 | | scan_delim_char (chs as c :: cs) = | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 196 | if is_blank c orelse is_meta c then raise LEXICAL_ERROR else (c, cs) | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 197 | | scan_delim_char [] = raise LEXICAL_ERROR; | 
| 240 | 198 | |
| 911 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 199 | val scan_sym = | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 200 |         $$ "_" >> K (Argument ("", 0)) ||
 | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 201 |         $$ "(" -- scan_int >> (Bg o #2) ||
 | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 202 | $$ ")" >> K En || | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 203 | $$ "/" -- $$ "/" >> K (Brk ~1) || | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 204 | $$ "/" -- scan_any is_blank >> (Brk o length o #2) || | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 205 | scan_any1 is_blank >> (Space o implode) || | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 206 | repeat1 scan_delim_char >> (Delim o implode); | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 207 | |
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 208 | val scan_symb = | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 209 | scan_sym >> Some || | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 210 | $$ "'" -- scan_one is_blank >> K None; | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 211 | in | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 212 | val scan_symbs = mapfilter I o #1 o repeat scan_symb; | 
| 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 213 | end; | 
| 240 | 214 | |
| 215 | ||
| 216 | val cons_fst = apfst o cons; | |
| 217 | ||
| 218 | fun add_args [] ty [] = ([], typ_to_nonterm1 ty) | |
| 219 | | add_args [] _ _ = err "too many precedences" | |
| 220 |       | add_args (Argument _ :: syms) (Type ("fun", [ty, tys])) [] =
 | |
| 221 | cons_fst (Argument (typ_to_nonterm ty, 0)) (add_args syms tys []) | |
| 222 |       | add_args (Argument _ :: syms) (Type ("fun", [ty, tys])) (p :: ps) =
 | |
| 223 | cons_fst (Argument (typ_to_nonterm ty, p)) (add_args syms tys ps) | |
| 224 | | add_args (Argument _ :: _) _ _ = | |
| 225 | err "more arguments than in corresponding type" | |
| 226 | | add_args (sym :: syms) ty ps = cons_fst sym (add_args syms ty ps); | |
| 227 | ||
| 228 | ||
| 229 | fun is_arg (Argument _) = true | |
| 230 | | is_arg _ = false; | |
| 231 | ||
| 232 | fun is_term (Delim _) = true | |
| 233 | | is_term (Argument (s, _)) = is_terminal s | |
| 234 | | is_term _ = false; | |
| 235 | ||
| 236 | fun rem_pri (Argument (s, _)) = Argument (s, chain_pri) | |
| 237 | | rem_pri sym = sym; | |
| 238 | ||
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 239 | fun is_delim (Delim _) = true | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 240 | | is_delim _ = false; | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 241 | |
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 242 | (*replace logical types on rhs by "logic"*) | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 243 | fun unify_logtypes copy_prod (a as (Argument (s, p))) = | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 244 | if s mem logtypes then Argument (logic, p) | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 245 | else a | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 246 | | unify_logtypes _ a = a; | 
| 240 | 247 | |
| 911 
55754d6d399c
new in mixfix annotations: "' " (quote space) separates delimiters without
 wenzelm parents: 
865diff
changeset | 248 | val raw_symbs = scan_symbs (explode sy); | 
| 240 | 249 | val (symbs, lhs) = add_args raw_symbs typ pris; | 
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 250 | val copy_prod = lhs mem ["prop", "logic"] | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 251 | andalso const <> "" | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 252 | andalso not (exists is_delim symbs); | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 253 | val lhs' = if convert andalso not copy_prod then | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 254 | (if lhs mem logtypes then logic | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 255 | else if lhs = "prop" then sprop else lhs) | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 256 | else lhs; | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 257 | val symbs' = map (unify_logtypes copy_prod) symbs; | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 258 | val xprod = XProd (lhs', symbs', const, pri); | 
| 240 | 259 | in | 
| 260 | seq check_pri pris; | |
| 261 | check_pri pri; | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 262 | check_blocks symbs'; | 
| 240 | 263 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 264 |     if is_terminal lhs' then err ("illegal lhs: " ^ lhs')
 | 
| 240 | 265 | else if const <> "" then xprod | 
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 266 | else if length (filter is_arg symbs') <> 1 then | 
| 240 | 267 | err "copy production must have exactly one argument" | 
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 268 | else if exists is_term symbs' then xprod | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 269 | else XProd (lhs', map rem_pri symbs', "", chain_pri) | 
| 240 | 270 | end; | 
| 271 | ||
| 272 | ||
| 273 | (** datatype syn_ext **) | |
| 274 | ||
| 275 | datatype syn_ext = | |
| 276 |   SynExt of {
 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 277 | logtypes: string list, | 
| 240 | 278 | xprods: xprod list, | 
| 279 | consts: string list, | |
| 280 | parse_ast_translation: (string * (ast list -> ast)) list, | |
| 281 | parse_rules: (ast * ast) list, | |
| 282 | parse_translation: (string * (term list -> term)) list, | |
| 283 | print_translation: (string * (term list -> term)) list, | |
| 284 | print_rules: (ast * ast) list, | |
| 285 | print_ast_translation: (string * (ast list -> ast)) list}; | |
| 286 | ||
| 287 | ||
| 288 | (* syn_ext *) | |
| 289 | ||
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 290 | fun mk_syn_ext convert logtypes mfixes consts trfuns rules = | 
| 240 | 291 | let | 
| 292 | val (parse_ast_translation, parse_translation, print_translation, | |
| 293 | print_ast_translation) = trfuns; | |
| 294 | val (parse_rules, print_rules) = rules; | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 295 | val logtypes' = logtypes \ "prop"; | 
| 240 | 296 | |
| 624 | 297 | val mfix_consts = distinct (map (fn (Mfix (_, _, c, _, _)) => c) mfixes); | 
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 298 | val xprods = map (mfix_to_xprod convert logtypes') mfixes; | 
| 240 | 299 | in | 
| 300 |     SynExt {
 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 301 | logtypes = logtypes', | 
| 624 | 302 | xprods = xprods, | 
| 368 | 303 | consts = filter is_xid (consts union mfix_consts), | 
| 240 | 304 | parse_ast_translation = parse_ast_translation, | 
| 305 | parse_rules = parse_rules, | |
| 306 | parse_translation = parse_translation, | |
| 307 | print_translation = print_translation, | |
| 308 | print_rules = print_rules, | |
| 309 | print_ast_translation = print_ast_translation} | |
| 310 | end; | |
| 311 | ||
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 312 | val syn_ext = mk_syn_ext true; | 
| 240 | 313 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 314 | fun syn_ext_logtypes logtypes = | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 315 | syn_ext logtypes [] [] ([], [], [], []) ([], []); | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 316 | |
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 317 | fun syn_ext_const_names logtypes cs = | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 318 | syn_ext logtypes [] cs ([], [], [], []) ([], []); | 
| 555 
a7f397a14b16
removed idT, varT, tidT, tvarT (now in lexicon.ML);
 wenzelm parents: 
441diff
changeset | 319 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 320 | fun syn_ext_rules logtypes rules = | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 321 | syn_ext logtypes [] [] ([], [], [], []) rules; | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 322 | |
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 323 | fun syn_ext_trfuns logtypes trfuns = | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 324 | syn_ext logtypes [] [] trfuns ([], []); | 
| 240 | 325 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 326 | (* pure_ext *) | 
| 240 | 327 | |
| 764 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 328 | val pure_ext = mk_syn_ext false [] | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 329 |   [Mfix ("_", spropT --> propT, "", [0], 0),
 | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 330 |    Mfix ("_", logicT --> anyT, "", [0], 0),
 | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 331 |    Mfix ("_", spropT --> anyT, "", [0], 0),
 | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 332 |    Mfix ("'(_')", logicT --> logicT, "", [0], max_pri),
 | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 333 |    Mfix ("'(_')", spropT --> spropT, "", [0], max_pri),
 | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 334 |    Mfix ("_::_",  [logicT, typeT] ---> logicT, "_constrain", [4, 0], 3),
 | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 335 |    Mfix ("_::_",  [spropT, typeT] ---> spropT, "_constrain", [4, 0], 3)]
 | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 336 | [] | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 337 | ([], [], [], []) | 
| 
b60e77395d1a
changed Pure's grammar and the way types are converted to nonterminals
 clasohm parents: 
624diff
changeset | 338 | ([], []); | 
| 240 | 339 | |
| 340 | end; |