-
Notifications
You must be signed in to change notification settings - Fork 0
/
compiler.hpp
42 lines (35 loc) · 894 Bytes
/
compiler.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef _COMPILER_HPP_
#define _COMPILER_HPP_
#include <string>
#include <vector>
#include "Command.hpp"
using namespace std;
class Compiler {
private:
string str;
char* cursor;
vector<Command> obj;
void program(void);
void statement(void);
bool parse_read(void);
bool parse_write(void);
bool parse_assignment(void);
bool parse_while_do(void);
bool parse_if_then(void);
void relational_expression(void);
void simple_expression(void);
void term(void);
void factor(void);
void unsigned_constant(void);
void skip(void);
void syntax_error(string message);
public:
Compiler(void);
void set_program_string(string str);
void set_program_file(string filename);
void compile(void);
void print_result(void);
void output_file(string filename);
vector<Command> get_obj(void);
};
#endif // _COMPILER_HPP_