summaryrefslogtreecommitdiff
path: root/sys/netiso/xebec/llparse.h
blob: f996d88ab0eeebf784a013bf70f7238ec7c57a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*	$NetBSD: llparse.h,v 1.4 1994/06/29 06:41:04 cgd Exp $	*/

	/************************************************************
		attributes stack garbage
	************************************************************/

#define LLMAXATTR	512
#define LLMAXDESC	256
#define	LLATTR		/* build an attribute stack */

	/*
	**	attribute stack
	**
	**	AttrStack =	stack of record
	**				values : array of values;
	**				ptr	: index;
	**	end;
	**
	*/

	typedef union llattrib LLattrib;

	extern LLattrib	llattributes[LLMAXATTR];
	extern int	llattrtop;

	extern struct	llattr {
		LLattrib	*llabase; /* ptr into the attr stack (llattributes) */
		int		llaindex;/* # attrs on the stack so far for this prod */
		int		llacnt;/* total # ever to go on for this prod */

		int		lloldtop;/* when popping this prod, restore stack to here ;
						 one attr will remain on the stack (for the lhs) */
	}	llattrdesc[LLMAXDESC];

	extern int	lldescindex;

	/************************************************************
		attributes stack garbage
	************************************************************/

	extern	struct	lltoken {
		short		llterm;		/* token number */
		short		llstate;	/* inserted deleted normal */
		LLattrib	llattrib; 
	} 	lltoken;
	typedef	struct lltoken	LLtoken;

/************************************************************
	constants used in llparse.c
************************************************************/

#define STACKSIZE	500
#define MAXCORR		16

#define	NORMAL		0
#define	DELETE		1
#define	INSERT		2

/************************************************************
	datatypes used to communicate with the parser
************************************************************/

struct	llinsert {
	short	llinscost;
	short	llinslength;
	short	llinsert[MAXCORR];
};
typedef	struct llinsert	LLinsert;

extern	short	llparsestack[];
extern	short	llstackptr;
extern	short	llinfinite;

/************************************************************
	variables used to pass information
	specific to each grammer
************************************************************/

extern	short	llnterms;
extern	short	llnsyms;
extern	short	llnprods;

extern	char	*llefile;

extern	struct	llparsetable {
	short	llterm;
	short	llprod;
}	llparsetable[];

extern	short	llparseindex[];

extern	short	llepsilon[];

extern	short	llproductions[];

extern	struct	llprodindex {
	short	llprodstart;
	short	llprodlength;
	short	llprodtlen;
}	llprodindex[];

extern	struct	llcosts {
	short	llinsert;
	short	lldelete;
}	llcosts[];

extern	struct	llstable {
	short	llsstart;
	short	llslength;
}	llstable[];

extern	short	llsspace[];

extern	struct	lletable {
	short	llecost;
	short	llelength;
	short	llestart;
}	lletable[];

extern	long	lleindex[];

extern	short	llespace[];

extern	char	*llstrings[];

/************************************************************
	routines defined in llparse.c
************************************************************/

extern llparse();
extern llcopye();
extern llcopys();
extern llcorrector();
extern llepsilonok();
extern llexpand();
extern short llfindaction();
extern llgetprefix();
extern llgettoken();
extern llinsert();
extern llinsertsym();
extern llinserttokens();
extern llparsererror();
extern llpushprod();
extern llreadetab();