]> git.saurik.com Git - bison.git/blame_incremental - src/lalr.h
Use ASCII for Sebastien Fricker's name.
[bison.git] / src / lalr.h
... / ...
CommitLineData
1/* Compute lookahead criteria for bison,
2
3 Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004, 2006 Free Software
4 Foundation, Inc.
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
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23#ifndef LALR_H_
24# define LALR_H_
25
26# include <bitset.h>
27# include <bitsetv.h>
28
29/* Import the definition of RULE_T. */
30# include "gram.h"
31
32/* Import the definition of CORE, TRANSITIONS and REDUCTIONS. */
33# include "state.h"
34
35
36/** Build the LALR(1) automaton.
37
38 Compute how to make the finite state machine deterministic; find
39 which rules need lookahead in each state, and which lookahead
40 tokens they accept.
41
42 Builds:
43 - #goto_map
44 - #from_state
45 - #to_state
46*/
47void lalr (void);
48
49
50/** Release the information related to lookahead tokens.
51
52 Can be performed once the action tables are computed. */
53void lalr_free (void);
54
55
56typedef size_t goto_number;
57# define GOTO_NUMBER_MAXIMUM ((goto_number) -1)
58
59/** Index into #from_state and #to_state.
60
61 All the transitions that accept a particular variable are grouped
62 together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and
63 TO_STATE of the first of them. */
64extern goto_number *goto_map;
65
66/** State number which a transition leads from. */
67extern state_number *from_state;
68
69/** State number it leads to. */
70extern state_number *to_state;
71
72
73#endif /* !LALR_H_ */