-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
63 lines (48 loc) · 1.78 KB
/
Copy pathmain.cpp
File metadata and controls
63 lines (48 loc) · 1.78 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <cstdlib>
#include <string>
#include "Token.h"
#include "StateMachine.h"
#include <iostream>
#include "Node.h"
#include "Parser.h"
#include "Scanner.h"
#include "Symbol.h"
#include <chrono>
#include <thread>
int main() {
// TokenClass tc;
// ScannerClass scanner("test.txt");
//
// while(true){
//
// tc = scanner.GetNextToken();
// std::cout << tc << " " << scanner.GetLineNumber() << std::endl;
// if (tc.GetTokenType() == ENDFILE_TOKEN){
// break;
// }
// }
ScannerClass sc("/Users/robbybowler/CLionProjects/compiler/test.txt");
SymbolTableClass st;
ParserClass pc(&sc, &st);
StartNode * s = pc.Start();
s->Interpret();
// SymbolTableClass ST;
// IdentifierNode * identifierOne = new IdentifierNode("sum", &ST);
// DeclarationStatementNode * declarationOne = new DeclarationStatementNode(identifierOne);
// IdentifierNode * identifierTwo = new IdentifierNode("sum", &ST);
// IntegerNode * integer = new IntegerNode(10);
// AssignmentStatementNode * assignmentStatementNode = new AssignmentStatementNode(identifierTwo, integer);
// IdentifierNode * identifierThreee = new IdentifierNode("sum", &ST);
// IntegerNode * integerTwo = new IntegerNode(20);
// PlusNode * plus = new PlusNode(identifierThreee, integerTwo);
// CoutStatementNode * cout = new CoutStatementNode(plus);
// StatementGroupNode * stateGroup = new StatementGroupNode();
// stateGroup->AddStatement(declarationOne);
// stateGroup->AddStatement(assignmentStatementNode);
// stateGroup->AddStatement(cout);
// BlockNode * blockNode = new BlockNode(stateGroup);
// ProgramNode * programNode = new ProgramNode(blockNode);
// StartNode * start = new StartNode(programNode);
// delete start;
// return 0;
}