aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/src/compiler_main.cpp
blob: dcc9e09f6094f4ca2c0e8a87fa329640d710375a (plain)
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
#include "node.hpp"
#include "bindings.hpp"

#include <cstdio>
#include <string>

Node* parseAST();

int main(int argc, char *argv[])
{
    (void)argc, (void)argv;
    
    try {
	std::unique_ptr<Node> ast(parseAST());
	VariableStackBindings bindings;
	unsigned label_count = 0;
	ast->printAsm(bindings, label_count);
	
    } catch(std::string error_msg) {
	fprintf(stderr, "%s\n", error_msg.c_str());
	
    } catch(...) {
	fprintf(stderr, "Error : Exception thrown\n");
    }

    return 0;
}