-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExtendParser.h
46 lines (40 loc) · 919 Bytes
/
ExtendParser.h
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
43
44
45
46
//
// Created by colors_wind on 2020/9/1.
//
#ifndef ALGORIMATRIX_EXTENDPARSER_H
#define ALGORIMATRIX_EXTENDPARSER_H
#include <iostream>
#include <map>
#include "TokenStream.h"
#include "Matrix.h"
#include "Token.h"
#include "ParseResult.h"
using std::string;
using std::map;
const static string ANS = "ans";
// E -> T{(+|-)T}
// T -> U{(*|/)U}
// U -> -F | +F | F
// F -> (E) | FUNCTION_1(L) | VARIABLE | [L] | NUMBER
// L -> E{,E}
class ExtendParser {
protected:
string m_input;
TokenStream m_stream;
Token m_token;
map<string, Matrix> m_matrix;
public:
ExtendParser ();
void advance();
Token & getToken();
ParseResult processS();
Matrix processE();
Matrix processT();
Matrix processU();
Matrix processF();
vector<struct Matrix> processL();
Matrix processM();
void input(string str);
void printVariable();
};
#endif //ALGORIMATRIX_EXTENDPARSER_H