new compiler/parser

This commit is contained in:
Lobo 2026-01-28 11:57:33 -03:00
parent 35bad08a0d
commit 7efa99d064
16 changed files with 419 additions and 302 deletions

View file

@ -2,11 +2,34 @@
#define PARSER_H
#include "common.h"
#include "vendor/mpc.h"
#include "lexer.h"
#include "vendor/yar.h"
V parser_init(V);
V parser_deinit(V);
enum {
AST_PROGRAM,
AST_INT,
AST_STR,
AST_WORD,
AST_LIST,
AST_TABLE,
AST_QUOTE,
AST_DEF,
AST_CMD,
AST_PRAGMA,
};
extern mpc_parser_t *Program;
typedef struct Ast {
I type;
char *name;
I int_val;
struct {
struct Ast **items;
Z count, capacity;
} children;
I line, col;
} Ast;
Ast *parser_parse(Lx *lx);
void ast_free(Ast *ast);
#endif