diff options
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/parser.h b/src/parser.h new file mode 100644 index 0000000..5563613 --- /dev/null +++ b/src/parser.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef PARSER_H | ||
2 | #define PARSER_H | ||
3 | |||
4 | #include <bu/list.h> | ||
5 | #include "token.h" | ||
6 | |||
7 | namespace Bu | ||
8 | { | ||
9 | class Stream; | ||
10 | }; | ||
11 | |||
12 | class Lexer; | ||
13 | |||
14 | class Parser | ||
15 | { | ||
16 | public: | ||
17 | Parser( Lexer &lex, Bu::Stream &rOut ); | ||
18 | virtual ~Parser(); | ||
19 | |||
20 | void parse(); | ||
21 | |||
22 | private: | ||
23 | void unwind(); | ||
24 | int reqTokens( Token::Type eType ); | ||
25 | int getPriority( Token::Type eType ); | ||
26 | |||
27 | private: | ||
28 | Lexer &lex; | ||
29 | Bu::Stream &rOut; | ||
30 | typedef Bu::List<Token> TokenStack; | ||
31 | TokenStack tsTerminal; | ||
32 | TokenStack tsNonTerminal; | ||
33 | }; | ||
34 | |||
35 | #endif | ||