]> git.saurik.com Git - bison.git/blob - src/reader.h
Initial check-in introducing experimental GLR parsing. See entry in
[bison.git] / src / reader.h
1 /* Input parser for bison
2 Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
3
4 This file is part of Bison, the GNU Compiler Compiler.
5
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.
10
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.
15
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. */
20
21 #ifndef READER_H_
22 # define READER_H_
23
24 # include "symlist.h"
25 # include "parse-gram.h"
26
27 typedef struct merger_list
28 {
29 struct merger_list* next;
30 const char* name;
31 const char* type;
32 }
33 merger_list;
34
35 typedef struct gram_control_s
36 {
37 int errcode;
38 } gram_control_t;
39
40 /* From the scanner. */
41 extern FILE *gram_in;
42 extern int gram__flex_debug;
43 void scanner_last_string_free PARAMS ((void));
44 void scanner_initialize PARAMS ((void));
45 void scanner_free PARAMS ((void));
46
47 # define YY_DECL \
48 int gram_lex (yystype *yylval, location_t *yylloc, \
49 gram_control_t *yycontrol)
50 YY_DECL;
51
52
53 /* From the parser. */
54 extern int gram_debug;
55 void gram_error (gram_control_t *control,
56 location_t *loc, const char *msg);
57 int gram_parse (void *control);
58
59 /* The sort of braced code we are in. */
60 typedef enum braced_code_e
61 {
62 action_braced_code,
63 destructor_braced_code,
64 printer_braced_code
65 } braced_code_t;
66 /* FIXME: This is really a dirty hack which demonstrates that we
67 should probably not try to parse the actions now. */
68 extern braced_code_t current_braced_code;
69
70
71 /* From reader.c. */
72 void grammar_start_symbol_set PARAMS ((symbol_t *s, location_t l));
73 void prologue_augment PARAMS ((const char *prologue, location_t location));
74 void epilogue_set PARAMS ((const char *epilogue, location_t location));
75 void grammar_symbol_append PARAMS ((symbol_t *s, location_t l));
76 void grammar_rule_begin PARAMS ((symbol_t *lhs, location_t l));
77 void grammar_rule_end PARAMS ((location_t l));
78 void grammar_midrule_action PARAMS ((void));
79 void grammar_current_rule_prec_set PARAMS ((symbol_t *precsym,
80 location_t l));
81 void grammar_current_rule_dprec_set PARAMS ((int dprec,
82 location_t l));
83 void grammer_current_rule_merge_set PARAMS ((const char* name,
84 location_t l));
85
86 void grammar_current_rule_symbol_append PARAMS ((symbol_t *symbol,
87 location_t l));
88 void grammar_current_rule_action_append PARAMS ((const char *action,
89 location_t l));
90 extern symbol_list_t *current_rule;
91 void reader PARAMS ((void));
92 void free_merger_functions PARAMS ((void));
93
94 extern merger_list *merge_functions;
95
96 extern int typed;
97
98 #endif /* !READER_H_ */