]>
Commit | Line | Data |
---|---|---|
f7d4d87a | 1 | /* Definitions for symtab.c and callers, part of bison, |
bba97eb2 | 2 | Copyright 1984, 1989, 1992, 2000, 2001, 2002 Free Software Foundation, Inc. |
f7d4d87a | 3 | |
340ef489 | 4 | This file is part of Bison, the GNU Compiler Compiler. |
f7d4d87a | 5 | |
340ef489 AD |
6 | Bison is free software; you can redistribute it and/or modify |
7 | it 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. | |
f7d4d87a | 10 | |
340ef489 AD |
11 | Bison is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
f7d4d87a | 15 | |
340ef489 AD |
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 | |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
f7d4d87a | 20 | |
340ef489 AD |
21 | #ifndef SYMTAB_H_ |
22 | # define SYMTAB_H_ | |
f7d4d87a DM |
23 | |
24 | #define TABSIZE 1009 | |
25 | ||
bba97eb2 AD |
26 | /* Associativity values for tokens and rules. */ |
27 | typedef enum | |
28 | { | |
29 | right_assoc, | |
30 | left_assoc, | |
31 | non_assoc | |
32 | } associativity; | |
33 | ||
f7d4d87a | 34 | |
bba97eb2 | 35 | /* Symbol classes. */ |
d7020c20 AD |
36 | typedef enum |
37 | { | |
38 | unknown_sym, | |
39 | token_sym, /* terminal symbol */ | |
40 | nterm_sym /* non-terminal */ | |
41 | } symbol_class; | |
340ef489 | 42 | |
6b7e85b9 | 43 | #define SUNDEF -1 /* For undefined user number. */ |
340ef489 AD |
44 | #define SALIAS -9991 /* for symbol generated with an alias */ |
45 | ||
46 | typedef struct bucket | |
47 | { | |
1e9798d5 | 48 | /* Needed for the hash table. */ |
340ef489 AD |
49 | struct bucket *link; |
50 | struct bucket *next; | |
f282676b AD |
51 | |
52 | /* The key, name of the symbol. */ | |
340ef489 | 53 | char *tag; |
f282676b | 54 | /* Its type. */ |
340ef489 | 55 | char *type_name; |
d9b739c3 | 56 | short number; |
340ef489 | 57 | short prec; |
d7020c20 | 58 | associativity assoc; |
340ef489 | 59 | short user_token_number; |
3f96f4dc | 60 | |
1e9798d5 AD |
61 | /* Points to the other in the identifier-symbol pair for an |
62 | alias. Special value SALIAS in the identifier half of the | |
63 | identifier-symbol pair for an alias. */ | |
340ef489 | 64 | struct bucket *alias; |
d7020c20 | 65 | symbol_class class; |
3f96f4dc | 66 | } bucket; |
f7d4d87a DM |
67 | |
68 | ||
f7d4d87a DM |
69 | extern bucket *firstsymbol; |
70 | ||
340ef489 AD |
71 | bucket *getsym PARAMS ((const char *)); |
72 | ||
73 | void tabinit PARAMS ((void)); | |
74 | void free_symtab PARAMS ((void)); | |
75 | ||
76 | #endif /* !SYMTAB_H_ */ |