2024-04-05 18:16:58 +01:00
|
|
|
#include "compiler.h"
|
2024-04-05 03:14:35 +01:00
|
|
|
#include <stddef.h>
|
2024-04-02 16:21:48 +01:00
|
|
|
#include <stdio.h>
|
2024-04-05 03:14:35 +01:00
|
|
|
#include <string.h>
|
2024-04-02 16:21:48 +01:00
|
|
|
|
2024-04-05 03:14:35 +01:00
|
|
|
bool lexer_debug = false;
|
|
|
|
|
|
|
|
void print_error(const char* message, Pos pos)
|
|
|
|
{
|
|
|
|
fprintf(
|
|
|
|
stderr, "\x1b[31merror\x1b[0m: %s, on line %d\n", message, pos.line);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
char test_program[] = " if a == true { (1) += 2; } ";
|
|
|
|
|
|
|
|
Parser parser;
|
|
|
|
parser_construct(&parser, test_program, strlen(test_program));
|
|
|
|
|
|
|
|
ASTNode* ast = parser_parse_statements(&parser);
|
|
|
|
|
|
|
|
printf("ast = %d\n", ast->node_type);
|
|
|
|
}
|