| 1 | (* Copyright (C) 2009,2017 Matthew Fluet. |
| 2 | * Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh |
| 3 | * Jagannathan, and Stephen Weeks. |
| 4 | * Copyright (C) 1997-2000 NEC Research Institute. |
| 5 | * |
| 6 | * MLton is released under a BSD-style license. |
| 7 | * See the file MLton-LICENSE for details. |
| 8 | *) |
| 9 | |
| 10 | signature AST_ATOMS_STRUCTS = |
| 11 | sig |
| 12 | structure AdmitsEquality: ADMITS_EQUALITY |
| 13 | structure CharSize: CHAR_SIZE |
| 14 | structure IntSize: INT_SIZE |
| 15 | structure RealSize: REAL_SIZE |
| 16 | structure Record: RECORD |
| 17 | structure SortedRecord: RECORD |
| 18 | structure Symbol: SYMBOL |
| 19 | structure TyconKind: TYCON_KIND |
| 20 | structure WordSize: WORD_SIZE |
| 21 | sharing Record.Field = SortedRecord.Field |
| 22 | sharing Symbol = Record.Field.Symbol |
| 23 | end |
| 24 | |
| 25 | signature AST_ATOMS = |
| 26 | sig |
| 27 | include AST_ATOMS_STRUCTS |
| 28 | |
| 29 | structure Const: AST_CONST |
| 30 | |
| 31 | structure Tyvar: |
| 32 | sig |
| 33 | include AST_ID |
| 34 | val isEquality: t -> bool |
| 35 | end |
| 36 | |
| 37 | structure Tycon: |
| 38 | sig |
| 39 | include AST_ID |
| 40 | include PRIM_TYCONS sharing type tycon = t |
| 41 | end |
| 42 | |
| 43 | structure Con: |
| 44 | sig |
| 45 | include AST_ID |
| 46 | include PRIM_CONS |
| 47 | sharing type con = t |
| 48 | end |
| 49 | |
| 50 | structure Var: AST_ID |
| 51 | |
| 52 | structure Vid: |
| 53 | sig |
| 54 | include AST_ID |
| 55 | |
| 56 | (* conversions to and from variables and constructors *) |
| 57 | val fromVar: Var.t -> t |
| 58 | val fromCon: Con.t -> t |
| 59 | val toVar: t -> Var.t |
| 60 | val toCon: t -> Con.t |
| 61 | |
| 62 | (* check special ids *) |
| 63 | val checkRedefineSpecial: |
| 64 | t * {allowIt: bool, |
| 65 | ctxt: unit -> Layout.t, |
| 66 | keyword: string} -> unit |
| 67 | val checkSpecifySpecial: |
| 68 | t * {allowIt: bool, |
| 69 | ctxt: unit -> Layout.t, |
| 70 | keyword: string} -> unit |
| 71 | end |
| 72 | |
| 73 | structure Strid: |
| 74 | sig |
| 75 | include AST_ID |
| 76 | val uArg: string -> t |
| 77 | val uRes: string -> t |
| 78 | val uSig: t |
| 79 | val uStr: t |
| 80 | end |
| 81 | structure Sigid: AST_ID |
| 82 | structure Fctid: AST_ID |
| 83 | |
| 84 | structure Basid: AST_ID |
| 85 | |
| 86 | structure Longtycon: |
| 87 | sig |
| 88 | include LONGID |
| 89 | val arrow: t |
| 90 | end sharing Longtycon.Id = Tycon |
| 91 | |
| 92 | structure Longcon: LONGID sharing Longcon.Id = Con |
| 93 | structure Longvar: LONGID sharing Longvar.Id = Var |
| 94 | structure Longvid: |
| 95 | sig |
| 96 | include LONGID |
| 97 | |
| 98 | val toLongcon: t -> Longcon.t |
| 99 | end sharing Longvid.Id = Vid |
| 100 | structure Longstrid: LONGID sharing Longstrid.Id = Strid |
| 101 | |
| 102 | sharing Strid = Longtycon.Strid = Longvar.Strid = Longcon.Strid |
| 103 | = Longvid.Strid = Longstrid.Strid |
| 104 | |
| 105 | sharing Symbol = Basid.Symbol = Con.Symbol = Fctid.Symbol |
| 106 | = Longcon.Symbol = Longstrid.Symbol = Longtycon.Symbol |
| 107 | = Longvar.Symbol = Longvid.Symbol = Sigid.Symbol |
| 108 | = Strid.Symbol = Tycon.Symbol = Tyvar.Symbol = Vid.Symbol |
| 109 | = Var.Symbol |
| 110 | |
| 111 | structure Type: |
| 112 | sig |
| 113 | type t |
| 114 | datatype node = |
| 115 | Con of Longtycon.t * t vector |
| 116 | | Paren of t |
| 117 | | Record of (Region.t * t) Record.t |
| 118 | | Var of Tyvar.t |
| 119 | |
| 120 | include WRAPPED sharing type node' = node |
| 121 | sharing type obj = t |
| 122 | |
| 123 | val arrow: t * t -> t |
| 124 | val checkSyntax: t -> unit |
| 125 | val con: Tycon.t * t vector -> t |
| 126 | val layout: t -> Layout.t |
| 127 | val layoutApp: Layout.t * 'a vector * ('a -> Layout.t) -> Layout.t |
| 128 | val layoutOption: t option -> Layout.t |
| 129 | val record: (Region.t * t) Record.t -> t |
| 130 | val tuple: t vector -> t |
| 131 | val unit: t |
| 132 | val var: Tyvar.t -> t |
| 133 | end |
| 134 | structure TypBind: |
| 135 | sig |
| 136 | type t |
| 137 | datatype node = T of {def: Type.t, |
| 138 | tycon: Tycon.t, |
| 139 | tyvars: Tyvar.t vector} vector |
| 140 | include WRAPPED sharing type node' = node |
| 141 | sharing type obj = t |
| 142 | |
| 143 | val checkSyntaxDef: t -> unit |
| 144 | val checkSyntaxSpec: t -> unit |
| 145 | val empty: t |
| 146 | val isEmpty: t -> bool |
| 147 | val layout: t -> Layout.t |
| 148 | end |
| 149 | structure DatBind: |
| 150 | sig |
| 151 | type t |
| 152 | datatype node = |
| 153 | T of {datatypes: {cons: (Con.t * Type.t option) vector, |
| 154 | tycon: Tycon.t, |
| 155 | tyvars: Tyvar.t vector} vector, |
| 156 | withtypes: TypBind.t} |
| 157 | include WRAPPED sharing type node' = node |
| 158 | sharing type obj = t |
| 159 | |
| 160 | val checkSyntaxDef: t -> unit |
| 161 | val checkSyntaxSpec: t -> unit |
| 162 | val layout: string * t -> Layout.t |
| 163 | end |
| 164 | structure DatatypeRhs: |
| 165 | sig |
| 166 | type t |
| 167 | datatype node = |
| 168 | DatBind of DatBind.t |
| 169 | | Repl of {lhs: Tycon.t, rhs: Longtycon.t} |
| 170 | include WRAPPED sharing type node' = node |
| 171 | sharing type obj = t |
| 172 | |
| 173 | val checkSyntaxDef: t -> unit |
| 174 | val checkSyntaxSpec: t -> unit |
| 175 | val layout: t -> Layout.t |
| 176 | end |
| 177 | structure ModIdBind: |
| 178 | sig |
| 179 | type t |
| 180 | datatype node = |
| 181 | Fct of {lhs: Fctid.t, rhs: Fctid.t} vector |
| 182 | | Sig of {lhs: Sigid.t, rhs: Sigid.t} vector |
| 183 | | Str of {lhs: Strid.t, rhs: Strid.t} vector |
| 184 | include WRAPPED sharing type node' = node |
| 185 | sharing type obj = t |
| 186 | |
| 187 | val checkSyntax: t -> unit |
| 188 | val layout: t -> Layout.t |
| 189 | end |
| 190 | |
| 191 | val bind: Layout.t * Layout.t -> Layout.t |
| 192 | val layoutAnds: string * 'a vector * (Layout.t * 'a -> Layout.t) |
| 193 | -> Layout.t |
| 194 | datatype bindStyle = |
| 195 | OneLine |
| 196 | | Split of int |
| 197 | val layoutAndsBind: |
| 198 | string * string * 'a vector * ('a -> bindStyle * Layout.t * Layout.t) |
| 199 | -> Layout.t |
| 200 | val layoutAndsSusp: string * 'a vector * (bool * Layout.t * 'a -> Layout.t) |
| 201 | -> (unit -> Layout.t) vector |
| 202 | val reportDuplicates: |
| 203 | 'a vector * {ctxt: unit -> Layout.t, |
| 204 | equals: 'a * 'a -> bool, |
| 205 | layout: 'a -> Layout.t, |
| 206 | name: string, |
| 207 | region: 'a -> Region.t} -> unit |
| 208 | val reportDuplicateFields: |
| 209 | (Record.Field.t * (Region.t * 'a)) vector * {ctxt: unit -> Layout.t} -> unit |
| 210 | val reportDuplicateTyvars: |
| 211 | Tyvar.t vector * {ctxt: unit -> Layout.t} -> unit |
| 212 | end |