1(* 2 Copyright David C. J. Matthews 2015-16 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License version 2.1 as published by the Free Software Foundation. 7 8 This library is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 Lesser General Public License for more details. 12 13 You should have received a copy of the GNU Lesser General Public 14 License along with this library; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16*) 17signature COMPILERBODYSIG = 18 19sig 20 type values; 21 type typeConstrSet; 22 type fixStatus; 23 type structVals; 24 type signatures; 25 type functors; 26 type ptProperties 27 28 type nameSpace = 29 { 30 lookupVal: string -> values option, 31 lookupType: string -> typeConstrSet option, 32 lookupFix: string -> fixStatus option, 33 lookupStruct: string -> structVals option, 34 lookupSig: string -> signatures option, 35 lookupFunct: string -> functors option, 36 37 enterVal: string * values -> unit, 38 enterType: string * typeConstrSet -> unit, 39 enterFix: string * fixStatus -> unit, 40 enterStruct: string * structVals -> unit, 41 enterSig: string * signatures -> unit, 42 enterFunct: string * functors -> unit, 43 44 allVal: unit -> (string*values) list, 45 allType: unit -> (string*typeConstrSet) list, 46 allFix: unit -> (string*fixStatus) list, 47 allStruct: unit -> (string*structVals) list, 48 allSig: unit -> (string*signatures) list, 49 allFunct: unit -> (string*functors) list 50 }; 51 52 type location = 53 { file: string, startLine: FixedInt.int, startPosition: FixedInt.int, 54 endLine: FixedInt.int, endPosition: FixedInt.int } 55 56 type exportTree = location * ptProperties list 57 58 (* The completed compiler. 59 Returns the parse tree and, if successful, a function that executes the 60 compiled code. *) 61 val compiler : 62 nameSpace * (unit->char option) * Universal.universal list -> 63 exportTree option * (unit -> 64 { fixes: (string * fixStatus) list, values: (string * values) list, 65 structures: (string * structVals) list, signatures: (string * signatures) list, 66 functors: (string * functors) list, types: (string * typeConstrSet) list }) option 67 68 structure Sharing: 69 sig 70 type values = values 71 and typeConstrSet = typeConstrSet 72 and fixStatus = fixStatus 73 and structVals = structVals 74 and signatures = signatures 75 and functors = functors 76 and ptProperties = ptProperties 77 end 78 79end; 80