X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/12aa4087bee3e70f170d7457794921de4e385227..1144856ba9d6018d9922c6ede7e97779a0fe6373:/parse/parse.sml diff --git a/parse/parse.sml b/parse/parse.sml index 5981be1..3786421 100644 --- a/parse/parse.sml +++ b/parse/parse.sml @@ -1,4 +1,4 @@ -(* L1 Compiler +(* L4 Compiler * Parsing * Author: Kaustuv Chaudhuri * Modified: Frank Pfenning @@ -17,10 +17,10 @@ end structure Parse :> PARSE = struct - structure L1LrVals = L1LrValsFn (structure Token = LrParser.Token) - structure L1Lex = L1LexFn (structure Tokens = L1LrVals.Tokens) - structure L1Parse = Join (structure ParserData = L1LrVals.ParserData - structure Lex = L1Lex + structure L4LrVals = L4LrValsFn (structure Token = LrParser.Token) + structure L4Lex = L4LexFn (structure Tokens = L4LrVals.Tokens) + structure L4Parse = Join (structure ParserData = L4LrVals.ParserData + structure Lex = L4Lex structure LrParser = LrParser) (* Main parsing function *) @@ -31,17 +31,17 @@ struct val _ = ParseState.setfile filename (* start at position 0 in filename *) fun parseerror (s, p1, p2) = ErrorMsg.error (ParseState.ext (p1,p2)) s val lexer = LrParser.Stream.streamify - (L1Lex.makeLexer (fn _ => TextIO.input instream)) + (L4Lex.makeLexer (fn _ => TextIO.input instream)) (* 0 = no error correction, 15 = reasonable lookahead for correction *) - val (absyn, _) = L1Parse.parse(0, lexer, parseerror, ()) + val (absyn, _) = L4Parse.parse(0, lexer, parseerror, ()) val _ = if !ErrorMsg.anyErrors then raise ErrorMsg.Error else () in absyn end) - handle L1Lex.LexError => ( ErrorMsg.error NONE "lexer error" ; - raise ErrorMsg.Error ) + handle Fail s => ( ErrorMsg.error NONE ("lexer error: "^s) ; + raise ErrorMsg.Error ) | LrParser.ParseError => raise ErrorMsg.Error (* always preceded by msg *) | e as IO.Io _ => ( ErrorMsg.error NONE (exnMessage e); raise ErrorMsg.Error )