sencha-lang/Sencha-lang/Parser.h

48 lines
972 B
C
Raw Normal View History

#ifndef PARSER_H
#define PARSER_H
#include <string>
#include <vector>
#include "Token.h"
using namespace std;
class Parser
{
public:
2012-11-08 20:16:00 +00:00
Parser();
virtual ~Parser();
void interpret();
string report_message;
string error_message;
2012-11-08 20:16:00 +00:00
void add_tokens(vector<Token> tokens);
string show_tokens();
protected:
private:
Token current_token;
string tok_value;
vector<Token> token_stream;
int position_in_stream;
2012-11-08 20:16:00 +00:00
bool in_statement;
bool read_next();
bool peek(string s);
bool accept(string s);
bool expect(string s);
bool is_type();
void error(string s);
void report(string s);
void statement();
2012-11-04 16:16:02 +00:00
void mul_expr();
void add_expr();
void prim_expr();
void postfix_expr();
void rel_expr();
void eq_expr();
void expr();
};
#endif // PARSER_H