1(* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi
2 *
3 * $Log$
4 * Revision 1.1  2006/06/22 07:40:27  michaeln
5 * Add a MoscowML compilable implementation of MLyacc, using the MLton sources
6 * as the base.
7 *
8 * Revision 1.1.1.1  1997/01/14 01:38:05  george
9 *   Version 109.24
10 *
11 * Revision 1.1.1.1  1996/01/31  16:01:45  george
12 * Version 109
13 *
14 *)
15local
16
17(* create parser *)
18
19   structure LrVals = MlyaccLrValsFun(structure Token = LrParser.Token
20				      structure Hdr = Header)
21   structure Lex = LexMLYACC(structure Tokens = LrVals.Tokens
22			     structure Hdr = Header)
23   structure Parser = JoinWithArg(structure Lex=Lex
24			         structure ParserData = LrVals.ParserData
25			         structure LrParser= LrParser)
26   structure ParseGenParser =
27	   ParseGenParserFun(structure Parser = Parser
28	                     structure Header = Header)
29
30(* create structure for computing LALR table from a grammar *)
31
32   structure MakeLrTable = mkMakeLrTable(structure IntGrammar =IntGrammar
33				     structure LrTable = LrTable)
34
35(* create structures for printing LALR tables:
36
37   Verbose prints a verbose description of an lalr table
38   PrintStruct prints an ML structure representing that is an lalr table *)
39
40   structure Verbose = mkVerbose(structure Errs = MakeLrTable.Errs)
41   structure PrintStruct =
42       mkPrintStruct(structure LrTable = MakeLrTable.LrTable
43		     structure ShrinkLrTable =
44                          ShrinkLrTableFun(structure LrTable=LrTable))
45in
46
47(* returns function which takes a file name, invokes the parser on the file,
48  does semantic checks, creates table, and prints it *)
49
50   structure ParseGen = ParseGenFun(structure ParseGenParser = ParseGenParser
51			            structure MakeTable = MakeLrTable
52			            structure Verbose = Verbose
53			            structure PrintStruct = PrintStruct
54				    structure Absyn = Absyn)
55end
56
57