]>
Commit | Line | Data |
---|---|---|
c29240e7 | 1 | /* Subroutines for bison |
8b3df748 | 2 | Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc. |
c29240e7 AD |
3 | |
4 | This file is part of Bison, the GNU Compiler Compiler. | |
5 | ||
6 | Bison is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | Bison is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with Bison; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
340ef489 AD |
21 | #ifndef CLOSURE_H_ |
22 | # define CLOSURE_H_ | |
c29240e7 | 23 | |
c29240e7 AD |
24 | /* Allocates the itemset and ruleset vectors, and precomputes useful |
25 | data so that closure can be called. n is the number of elements to | |
26 | allocate for itemset. */ | |
27 | ||
28 | void new_closure PARAMS ((int n)); | |
29 | ||
30 | ||
b2872512 | 31 | /* Given the kernel (aka core) of a state (a vector of item numbers |
8b3df748 | 32 | ITEMS, of length N), set up RULESET and ITEMSET to indicate what |
b2872512 AD |
33 | rules could be run and which items could be accepted when those |
34 | items are the active ones. | |
c29240e7 | 35 | |
8b3df748 | 36 | RULESET contains a bit for each rule. CLOSURE sets the bits for |
c29240e7 AD |
37 | all rules which could potentially describe the next input to be |
38 | read. | |
39 | ||
b2872512 | 40 | ITEMSET is a vector of item numbers; NITEMSET is its size |
8b3df748 AD |
41 | (actually, points to just beyond the end of the part of it that is |
42 | significant). CLOSURE places there the indices of all items which | |
b2872512 | 43 | represent units of input that could arrive next. */ |
c29240e7 AD |
44 | |
45 | void closure PARAMS ((short *items, int n)); | |
46 | ||
47 | ||
8b3df748 | 48 | /* Frees ITEMSET, RULESET and internal data. */ |
c29240e7 AD |
49 | |
50 | void free_closure PARAMS ((void)); | |
340ef489 AD |
51 | |
52 | extern short *itemset; | |
5123689b | 53 | extern int nritemset; |
340ef489 AD |
54 | |
55 | #endif /* !CLOSURE_H_ */ |