]>
Commit | Line | Data |
---|---|---|
742e4900 | 1 | /* Compute lookahead criteria for bison, |
779e7ceb PE |
2 | |
3 | Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004 Free Software | |
4 | Foundation, Inc. | |
720d742f AD |
5 | |
6 | This file is part of Bison, the GNU Compiler Compiler. | |
7 | ||
8 | Bison 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 2, or (at your option) | |
11 | any later version. | |
12 | ||
13 | Bison 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. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with Bison; see the file COPYING. If not, write to | |
0fb669f9 PE |
20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 | Boston, MA 02110-1301, USA. */ | |
720d742f AD |
22 | |
23 | #ifndef LALR_H_ | |
24 | # define LALR_H_ | |
25 | ||
b78d8c23 PE |
26 | # include <bitset.h> |
27 | # include <bitsetv.h> | |
a70083a3 | 28 | |
b0299a2e AD |
29 | /* Import the definition of RULE_T. */ |
30 | # include "gram.h" | |
a70083a3 | 31 | |
b78d8c23 PE |
32 | /* Import the definition of CORE, TRANSITIONS and REDUCTIONS. */ |
33 | # include "state.h" | |
34 | ||
720d742f | 35 | /* Compute how to make the finite state machine deterministic; find |
742e4900 | 36 | which rules need lookahead in each state, and which lookahead |
720d742f AD |
37 | tokens they accept. */ |
38 | ||
d33cb3ae | 39 | void lalr (void); |
720d742f | 40 | |
742e4900 | 41 | /* Release the information related to lookahead tokens. Can be performed |
3325ddc4 AD |
42 | once the action tables are computed. */ |
43 | ||
d33cb3ae | 44 | void lalr_free (void); |
3325ddc4 | 45 | |
720d742f AD |
46 | |
47 | /* lalr() builds these data structures. */ | |
48 | ||
43591cec | 49 | /* GOTO_MAP, FROM_STATE and TO_STATE -- record each shift transition |
720d742f AD |
50 | which accepts a variable (a nonterminal). |
51 | ||
43591cec AD |
52 | FROM_STATE[T] -- state number which a transition leads from. |
53 | TO_STATE[T] -- state number it leads to. | |
54 | ||
55 | All the transitions that accept a particular variable are grouped | |
56 | together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and | |
57 | TO_STATE of the first of them. */ | |
720d742f | 58 | |
7886c2d4 | 59 | typedef size_t goto_number; |
b03595a5 | 60 | # define GOTO_NUMBER_MAXIMUM ((goto_number) -1) |
e68e0410 | 61 | |
b78d8c23 PE |
62 | extern goto_number *goto_map; |
63 | extern state_number *from_state; | |
64 | extern state_number *to_state; | |
720d742f | 65 | |
720d742f | 66 | |
720d742f | 67 | #endif /* !LALR_H_ */ |