Add runtime specs
This commit is contained in:
parent
9618efd12a
commit
3417ad5adb
11 changed files with 542 additions and 294 deletions
42
src/runtime/parser.c
Normal file
42
src/runtime/parser.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "runtime.h"
|
||||
|
||||
|
||||
static int INITIAL_STATE_STACK_SIZE = 100;
|
||||
static int INITIAL_SYMBOL_STACK_SIZE = 100;
|
||||
|
||||
|
||||
TSParser TSParserMake(const char *input) {
|
||||
TSState *state_stack = calloc(INITIAL_STATE_STACK_SIZE, sizeof(*state_stack));
|
||||
TSSymbol *symbol_stack = calloc(INITIAL_SYMBOL_STACK_SIZE, sizeof(*symbol_stack));
|
||||
TSParser result = {
|
||||
.input = input,
|
||||
.tree = TSTreeMake(),
|
||||
.position = 0,
|
||||
.state_stack = state_stack,
|
||||
.symbol_stack = symbol_stack,
|
||||
.state_count = 0,
|
||||
.symbol_count = 0
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
void TSParserShift(TSParser *parser, TSState state) {
|
||||
|
||||
}
|
||||
|
||||
void TSParserReduce(TSParser *parser, TSSymbol symbol, int child_count) {
|
||||
|
||||
}
|
||||
|
||||
void TSParserError(TSParser *parser) {
|
||||
|
||||
}
|
||||
|
||||
TSSymbol TSParserLookahead(const TSParser *parser) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
TSState TSParserState(const TSParser *parser) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue