| 1 |
|
|---|
| 2 | /* Parser generator main program */
|
|---|
| 3 |
|
|---|
| 4 | /* This expects a filename containing the grammar as argv[1] (UNIX)
|
|---|
| 5 | or asks the console for such a file name (THINK C).
|
|---|
| 6 | It writes its output on two files in the current directory:
|
|---|
| 7 | - "graminit.c" gets the grammar as a bunch of initialized data
|
|---|
| 8 | - "graminit.h" gets the grammar's non-terminals as #defines.
|
|---|
| 9 | Error messages and status info during the generation process are
|
|---|
| 10 | written to stdout, or sometimes to stderr. */
|
|---|
| 11 |
|
|---|
| 12 | /* XXX TO DO:
|
|---|
| 13 | - check for duplicate definitions of names (instead of fatal err)
|
|---|
| 14 | */
|
|---|
| 15 |
|
|---|
| 16 | #include "Python.h"
|
|---|
| 17 | #include "pgenheaders.h"
|
|---|
| 18 | #include "grammar.h"
|
|---|
| 19 | #include "node.h"
|
|---|
| 20 | #include "parsetok.h"
|
|---|
| 21 | #include "pgen.h"
|
|---|
| 22 |
|
|---|
| 23 | int Py_DebugFlag;
|
|---|
| 24 | int Py_VerboseFlag;
|
|---|
| 25 | int Py_IgnoreEnvironmentFlag;
|
|---|
| 26 |
|
|---|
| 27 | /* Forward */
|
|---|
| 28 | grammar *getgrammar(char *filename);
|
|---|
| 29 |
|
|---|
|
|---|