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