-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMochaLang.cpp
50 lines (37 loc) · 1.12 KB
/
MochaLang.cpp
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
// MochaLang.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <stack>
#include <vector>
#include "mocha.h"
int main()
{
std::map<std::string, std::string> map;
MochaLexer lexer;
lexer.loadSpecials(".\\lang\\mochalang_specials.lex");
lexer.loadKeywords(".\\lang\\mochalang_keywords.lex");
lexer.loadPrecedence(".\\lang\\mochalang_tokens.lex");
//MochaOpcodeProvider::loadGrammarFile(".\\lang\\Mochalang.gr");
//std::cout << MochaOpcodeProvider::loadText(".\\lang\\sample.ma");
//for (int i = 0; i < MochaOpcodeProvider::grammar.size(); i++)
//{
// MochaOpcodeProvider::GRAMMAR_RULE rule = MochaOpcodeProvider::grammar[i];
// for (int j = 0; j < rule.rules.size(); j++)
// {
// std::cout << rule.name << " " << rule.rules[j] << std::endl;
// }
//}
std::vector<token*> tokens = lexer.lex(lexer.loadText(".\\lang\\sample.ma"), map);
Parser parser;
std::vector<token*> parsed = parser.parse(tokens);
/*for (int i = 0; i < tokens.size(); i++)
{
tokens[i]->print();
}*/
while (true) {}
return 0;
}