1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.6),
3 // last updated on Nov 2, 1999.
4 // The original source file is "parser.ph".
5 ///////////////////////////////////////////////////////////////////////////////
7 #define PROP_PARSER_USED
10 ///////////////////////////////////////////////////////////////////////////////
12 // Definition of the Prop parser.
14 ///////////////////////////////////////////////////////////////////////////////
15 #ifndef prop_parser_interface_h
16 #define prop_parser_interface_h
19 #include <AD/automata/iolexerstack.h>
28 ///////////////////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////////////
36 NONE
= 0, C
= 1, PROP
= 2,
37 COMMENT
= 3, QUOTE
= 4, ANTIQUOTE
= 5
47 ///////////////////////////////////////////////////////////////////////////////
49 // The syntax class PropParser describe the interface to the
50 // parsing/lexing front end.
52 ///////////////////////////////////////////////////////////////////////////////
55 class PropParser
: public LR1Parser
{
57 ////////////////////////////////////////////////////////////////////////////
58 // Parser table type definitions
59 ////////////////////////////////////////////////////////////////////////////
60 typedef LR1Parser Super
;
61 typedef Super::Offset Offset
;
62 typedef Super::State State
;
63 typedef Super::Rule Rule
;
64 typedef Super::Symbol Symbol
;
65 typedef Super::ProductionLength ProductionLength
;
66 typedef Super::ShortSymbol ShortSymbol
;
67 typedef Super::EquivMap EquivMap
;
68 enum { INITIAL_STACK_SIZE_
= 256,
69 MAX_STACK_SIZE_
= 8192
72 ////////////////////////////////////////////////////////////////////////////
73 // Semantic value stack
74 ////////////////////////////////////////////////////////////////////////////
75 union PropParser_semantic_stack_type
* t__
, * bot__
;
79 ////////////////////////////////////////////////////////////////////////////
80 // Constructor and parsing method
81 ////////////////////////////////////////////////////////////////////////////
84 void action_driver(const Rule
);
86 void adjust_stack(int);
87 void grow_semantic_stack();
89 PropParser(const PropParser
&);
90 void operator = (const PropParser
&);
92 enum { MAX_LEXICAL_DEPTH
= 256,
94 MAX_INCLUDE_FILES
= 256
97 ////////////////////////////////////////////////////////////////////////////
99 ////////////////////////////////////////////////////////////////////////////
102 ////////////////////////////////////////////////////////////////////////////
103 // Lexical context stack. This is used to keep track of the
104 // current lexical context.
105 ////////////////////////////////////////////////////////////////////////////
106 LexicalContext SCs
[MAX_LEXICAL_DEPTH
];
108 int levels
[MAX_LEXICAL_DEPTH
];
110 Decls code_stack
[MAX_LEXICAL_DEPTH
];
112 void start_sc (LexicalContext
); // enter a new lexical context
113 void end_sc (); // leave the current lexical context
115 ////////////////////////////////////////////////////////////////////////////
117 ////////////////////////////////////////////////////////////////////////////
119 const char * file_name
;
123 Quote(const char * file
, int line
, char a
, char b
)
124 : file_name(file
), line_number(line
), open(a
), close(b
) {}
126 Quote quote_stack
[MAX_LEXICAL_DEPTH
];
128 void start_quote(char, char);
129 char end_quote (char);
130 void start_statement ();
131 void end_statement ();
133 ////////////////////////////////////////////////////////////////////////////
134 // Internal code and documentation buffer.
135 ////////////////////////////////////////////////////////////////////////////
142 void emit (const char *, long = -1);
144 void emit_cons (Id cons_name
);
150 ////////////////////////////////////////////////////////////////////////////
151 // Pattern variable environment and match expression stack
152 ////////////////////////////////////////////////////////////////////////////
153 PatternVarEnv pv_env
; // pattern variable environment
154 MatchExps me_stack
[MAX_LEXICAL_DEPTH
]; // match expression stack
155 MatchOptions match_kind
[MAX_LEXICAL_DEPTH
]; // kind of match construct
156 int me_top
; // top of me stack
158 ////////////////////////////////////////////////////////////////////////////
159 // Variable binding stack
160 ////////////////////////////////////////////////////////////////////////////
161 Id var_stack
[MAX_ARITY
];
162 Pat pat_stack
[MAX_ARITY
];
165 ////////////////////////////////////////////////////////////////////////////
166 // Include file stack
167 ////////////////////////////////////////////////////////////////////////////
172 std::istream
* file_stream
;
177 IncludeFile includes
[MAX_INCLUDE_FILES
];
179 const char * included_files
[MAX_INCLUDE_FILES
];
182 ////////////////////////////////////////////////////////////////////////////
183 // Miscellaneous flags and counters
184 ////////////////////////////////////////////////////////////////////////////
185 int antecedent_count
; // number of antecedents in an inference rule
186 Bool in_rewrite
; // are we in rewriting?
187 int rule_count
; // number of rules
188 int is_view_def
; // are we in a view definition?
189 int symbol_count
; // number of symbols in a production
190 int item_count
; // number of items in a production
191 int nonterm_count
; // number of non-terminals in a production
196 { MatchRuleInfo::RewritingMode mode
; // current rewrite mode
197 MatchRuleInfo::RewritingOption option
;
199 } rw_stack
[MAX_LEXICAL_DEPTH
]; // kind of rewriting mode
200 int rw_top
; // top of rw stack
201 void push_rw_stack();
204 ////////////////////////////////////////////////////////////////////////////
205 // The program being constructed.
206 ////////////////////////////////////////////////////////////////////////////
209 Compiler
* compiler
; // the current compiler
210 GraphTypeDef
* graphtype_def
; // the current graph type definition
213 ////////////////////////////////////////////////////////////////////////////
214 // The public interface
215 ////////////////////////////////////////////////////////////////////////////
216 virtual ~PropParser();
218 int get_token (); // method to retrieve a token
219 int get_token2 (); // method to retrieve a token
220 ErrorAction
error_report (const char *); // error reporting.
221 void initialize (Compiler
&);
222 void initialize_lexer (const char * file_name
);
223 void cleanup_lexer();
224 void print_header(Compiler
&);
228 void open_include_file (const char *); // open a new include file
229 void close_include_file (); // close include file
231 Decls
mkcode (Decls
);
232 Pat
mkconspat (Cons
);
234 Ty
lookup_tyvar (Id
);
235 Pat
lookup_patvar (Id
);
236 void add_parse_stack_binding (int,int,int);
238 // For error explanation
239 void print_user_symbol (std::ostream
&, Symbol
);
240 void explain_error();
241 #line 185 "parser.ph"
243 #line 185 "parser.ph"
244 #line 185 "parser.ph"
248 #line 188 "parser.ph"
250 ------------------------------- Statistics -------------------------------
251 Merge matching rules = yes
252 Number of DFA nodes merged = 0
253 Number of ifs generated = 0
254 Number of switches generated = 0
257 Adaptive matching = enabled
258 Fast string matching = disabled
259 Inline downcasts = enabled
260 --------------------------------------------------------------------------