Import Upstream version 20180207
[hcoop/debian/mlton.git] / mlyacc / src / link.sml
CommitLineData
7f918cf1
CE
1(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
2local
3
4(* create parser *)
5
6 structure LrVals = MlyaccLrValsFun(structure Token = LrParser.Token
7 structure Hdr = Header)
8 structure Lex = LexMLYACC(structure Tokens = LrVals.Tokens
9 structure Hdr = Header)
10 structure Parser = JoinWithArg(structure Lex=Lex
11 structure ParserData = LrVals.ParserData
12 structure LrParser= LrParser)
13 structure ParseGenParser =
14 ParseGenParserFun(structure Parser = Parser
15 structure Header = Header)
16
17(* create structure for computing LALR table from a grammar *)
18
19 structure MakeLrTable = mkMakeLrTable(structure IntGrammar =IntGrammar
20 structure LrTable = LrTable)
21
22(* create structures for printing LALR tables:
23
24 Verbose prints a verbose description of an lalr table
25 PrintStruct prints an ML structure representing that is an lalr table *)
26
27 structure Verbose = mkVerbose(structure Errs = MakeLrTable.Errs)
28 structure PrintStruct =
29 mkPrintStruct(structure LrTable = MakeLrTable.LrTable
30 structure ShrinkLrTable =
31 ShrinkLrTableFun(structure LrTable=LrTable))
32in
33
34(* returns function which takes a file name, invokes the parser on the file,
35 does semantic checks, creates table, and prints it *)
36
37 structure ParseGen = ParseGenFun(structure ParseGenParser = ParseGenParser
38 structure MakeTable = MakeLrTable
39 structure Verbose = Verbose
40 structure PrintStruct = PrintStruct
41 structure Absyn = Absyn)
42end