lang: replace stack-based parser with a recursive parser

This commit is contained in:
2026-04-06 18:25:43 +01:00
parent 3a549aa6df
commit b904813cef
77 changed files with 2984 additions and 6499 deletions
-22
View File
@@ -1,26 +1,4 @@
#ifndef _AST_BLOCK_H_
#define _AST_BLOCK_H_
#include "ctx.h"
#define BLOCK_TERMINATOR_MAX 8
struct block_parser_state {
struct parser_state s_base;
bool s_single_expr;
/* the block will be terminated when any token in this list
* is encountered. the token that terminated the block will
* not be consumed. */
unsigned short s_terminators[BLOCK_TERMINATOR_MAX];
unsigned short s_nr_terminators;
};
extern void block_add_terminator(
struct block_parser_state *state, unsigned short tok);
extern void block_copy_terminators(
const struct block_parser_state *src, struct block_parser_state *dest);
extern bool block_terminates_at_token(
struct block_parser_state *state, unsigned short tok);
#endif