Import Upstream version 20180207
[hcoop/debian/mlton.git] / mlyacc / examples / fol / README
CommitLineData
7f918cf1
CE
1fol/README
2
3This is a sample parser for first-order logic. The grammar
4was contributed by Frank Pfenning.
5
6The parser is defined by the files
7
8 fol.lex (* defines lexer *)
9 fol.grm (* defines grammar *)
10 link.sml (* constructs basic parser structures *)
11 absyn.sml (* a trivial abstract syntax *)
12 interface.sml (* interface to lexer and parser properties *)
13 parse.sml (* driver functions *)
14 fol.mlb (* ML Basis file *)
15
16To compile this example, type the following commands
17
18 mllex fol.lex
19 mlyacc fol.grm
20 mlton fol.mlb
21
22in this directory. They will invoke ml-lex and ml-yacc to process the
23lexer specification fol.lex and the grammar specification fol.grm
24respectively. Then they will compile the resulting SML source files
25
26 fol.lex.sml
27 fol.grm.sig
28 fol.grm.sml
29
30and the other sml source files.
31
32The end result of loading these files is a structure Parse containing
33the following top-level driver functions:
34
35 val prog_parse : string -> Absyn.absyn
36 (* parse a program from a string *)
37
38 val query_parse : string -> Absyn.absyn
39 (* parse a query from a string *)
40
41 val file_parse : string -> Absyn.absyn
42 (* parse a program in a file *)
43
44 val top_parse : unit -> Absyn.absyn
45 (* parse a query from the standard input *)
46
47
48The file list.fol is a sample input file that can be parsed using
49the file_parse function:
50
51 - Parse.file_parse "list.fol";
52
53
54NOTE: The ML Basis file sources.cm mentions the ml-yacc library
55(ml-yacc-lib.cm). MLton's search path should be configured so that this
56library will be found. This should normally be the case if MLton is
57properly installed.