-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.sml
More file actions
19 lines (18 loc) · 736 Bytes
/
Copy pathparse.sml
File metadata and controls
19 lines (18 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
structure Parse =
struct
structure SlpAstLrVals = SlpAstLrValsFun(structure Token = LrParser.Token)
structure Lex = SlpLexFun(structure Tokens = SlpAstLrVals.Tokens)
structure SlpAstP = Join(structure ParserData = SlpAstLrVals.ParserData
structure Lex=Lex
structure LrParser = LrParser)
fun parse filename =
let val _ = (ErrorMsg.reset(); ErrorMsg.fileName := filename)
val file = TextIO.openIn filename
fun get _ = TextIO.input file
fun parseerror(s,p1,p2) = ErrorMsg.error p1 s
val lexer = LrParser.Stream.streamify (Lex.makeLexer get)
val (absyn, _) = SlpAstP.parse(30,lexer,parseerror,())
in TextIO.closeIn file;
absyn
end handle LrParser.ParseError => raise ErrorMsg.Error
end