Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | This is a grammar for Berkeley Pascal, hacked to be SLR, though that is |
2 | not necessary because ML-Yacc supports LALR(1). | |
3 | ||
4 | To construct the parser, make this your current directory and run the | |
5 | following commands | |
6 | ||
7 | mllex pascal.lex | |
8 | mlyacc pascal.grm | |
9 | mlton pascal.mlb | |
10 | ||
11 | They will apply ML-Yacc to the file "pascal.grm" to create | |
12 | the files "pascal.grm.sig" and "pascal.grm.sml", then | |
13 | ML_Lex will be applied to pascal.lex to produce pascal.lex.sml. | |
14 | ||
15 | Then these generated files will be compiled together with necessary | |
16 | components from the ML-Yacc library supplied by the ml-yacc-lib.cm | |
17 | file. | |
18 | ||
19 | The end result is a structure Parser with two functions. The | |
20 | function | |
21 | ||
22 | parse: string -> | |
23 | PascalParser.result * | |
24 | (Parser.PascalParser.svalue,PascalParser.pos) LrParser.Token.token | |
25 | LrParser.stream | |
26 | ||
27 | parses input from a file, while | |
28 | ||
29 | keybd: unit -> | |
30 | Parser.PascalParser.result * | |
31 | (Parser.PascalParser.svalue,Parser.PascalParser.pos) | |
32 | LrParser.Token.token LrParser.stream | |
33 | ||
34 | parses from the standard input. |