aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/moonc.cpp
blob: 1a383fe94ebf015adc1cfe7b455c772b8562ee01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include "moon_compiler.h"

int main()
{
	std::string s = R"TestCodesHere(
print nil + 1
)TestCodesHere";
	std::list<MoonP::GlobalVar> globals;
	auto result = MoonP::moonCompile(s, globals, true, false);
	if (!result.first.empty()) {
		std::cout << result.first << '\n';
	} else {
		std::cout << result.second << '\n';
	}
	std::cout << "globals:\n";
	for (const auto& var : globals) {
		std::cout << var.name << '\n';
	}
	return 0;
}