source: trunk/essentials/dev-lang/python/Include/grammar.h@ 3396

Last change on this file since 3396 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 2.0 KB
Line 
1
2/* Grammar interface */
3
4#ifndef Py_GRAMMAR_H
5#define Py_GRAMMAR_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#include "bitset.h" /* Sigh... */
11
12/* A label of an arc */
13
14typedef struct {
15 int lb_type;
16 char *lb_str;
17} label;
18
19#define EMPTY 0 /* Label number 0 is by definition the empty label */
20
21/* A list of labels */
22
23typedef struct {
24 int ll_nlabels;
25 label *ll_label;
26} labellist;
27
28/* An arc from one state to another */
29
30typedef struct {
31 short a_lbl; /* Label of this arc */
32 short a_arrow; /* State where this arc goes to */
33} arc;
34
35/* A state in a DFA */
36
37typedef struct {
38 int s_narcs;
39 arc *s_arc; /* Array of arcs */
40
41 /* Optional accelerators */
42 int s_lower; /* Lowest label index */
43 int s_upper; /* Highest label index */
44 int *s_accel; /* Accelerator */
45 int s_accept; /* Nonzero for accepting state */
46} state;
47
48/* A DFA */