aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
blob: c0168926228e333e7a049a5c1c781c5221161c84 (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 <stdio.h>
#include <string.h>
#include "../include/compiler.h"

int main() {
    amal_compiler compiler;
    int result;
    const char *filepath;
    filepath = "tests/main.amal";

    result = amal_compiler_init(&compiler);
    if(result != AMAL_COMPILER_OK) {
        fprintf(stderr, "Failed to initialize compiler, error code: %d\n", result);
        return 1;
    }

    result = amal_compiler_load_file(&compiler, create_buffer_view(filepath, strlen(filepath)));
    if(result != AMAL_COMPILER_OK) {
        fprintf(stderr, "Failed to load file, error code: %d\n", result);
        return 1;
    }

#ifdef DEBUG
    return amal_compiler_deinit(&compiler);
#endif
    return 0;
}