]>
git.saurik.com Git - bison.git/blob - src/lalr.h
1 /* Compute look-ahead criteria for bison,
3 Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004 Free Software
6 This file is part of Bison, the GNU Compiler Compiler.
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)
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.
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
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
29 /* Import the definition of RULE_T. */
32 /* Import the definition of CORE, TRANSITIONS and REDUCTIONS. */
35 /* Compute how to make the finite state machine deterministic; find
36 which rules need look-ahead in each state, and which look-ahead
37 tokens they accept. */
41 /* Release the information related to look-ahead tokens. Can be performed
42 once the action tables are computed. */
44 void lalr_free (void);
47 /* lalr() builds these data structures. */
49 /* GOTO_MAP, FROM_STATE and TO_STATE -- record each shift transition
50 which accepts a variable (a nonterminal).
52 FROM_STATE[T] -- state number which a transition leads from.
53 TO_STATE[T] -- state number it leads to.
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. */
59 typedef size_t goto_number
;
60 # define GOTO_NUMBER_MAXIMUM ((goto_number) -1)
62 extern goto_number
*goto_map
;
63 extern state_number
*from_state
;
64 extern state_number
*to_state
;