making parser

This commit is contained in:
2024-12-20 00:00:51 +02:00
parent 69e90b6b9f
commit 228b215259
7 changed files with 405 additions and 196 deletions

32
parser.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef _ZIG1_PARSE_H__
#define _ZIG1_PARSE_H__
#include <stdbool.h>
#include <stdint.h>
#include "ast.h"
typedef struct {
uint32_t len;
uint32_t cap;
astNodeIndex* arr;
} parserNodeIndexSlice;
typedef struct {
const char* source;
const uint32_t source_len;
tokenizerTag* token_tags;
astIndex* token_starts;
uint32_t tokens_len;
astTokenIndex tok_i;
astNodeList nodes;
parserNodeIndexSlice extra_data;
parserNodeIndexSlice scratch;
} parser;
int parse_root(parser*);
#endif