-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsmGrammarDefs.hpp
More file actions
35 lines (30 loc) · 1.07 KB
/
smGrammarDefs.hpp
File metadata and controls
35 lines (30 loc) · 1.07 KB
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
#ifndef SM_GRAMMAR_DEFS_HPP
#define SM_GRAMMAR_DEFS_HPP
#include <iostream>
#include <string>
#include <vector>
using std::cout;
using std::vector;
using std::string;
vector<string> tokennames = {
"lparen", "rparen", "add", "sub", "multiply", "divide", "semicolon", "comma", "period",
"equals", "assignsym", "beginsym", "endsym", "procsym", "callsym", "whilesym", "idsym", "ifsym", "dosym",
"thensym", "number", "errsym", "whitespace", "varsym", "eofsym", "oddsym", "neqsym" "ltsym", "gtsym", "gtesym", "ltesym", "constsym"};
typedef enum syms {
lparen,rparen,add,sub,multiply,divide,semicolon,comma,period,
equals,assignsym,beginsym,endsym,procsym,callsym,whilesym,idsym,ifsym, dosym,
thensym, number,errsym,whitespace,varsym,eofsym,oddsym, neqsym, ltsym, gtsym, gtesym, ltesym, constsym
} Symbol;
struct TokenList {
string text;
Symbol token;
int lineno;
TokenList* next;
TokenList(string t, Symbol s, int ln) {
text = t;
token = s;
lineno = ln;
next = nullptr;
}
};
#endif