Lexer partially working

This commit is contained in:
2022-08-03 14:06:54 +01:00
parent 3cad70dddd
commit 1ff32fe101
17 changed files with 687 additions and 34 deletions

21
source/parser.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include "parser.h"
#include "lexer.h"
#include "node.h"
//DOCS: parsers are bound to a lexer, and turn the outputted tokens into AST nodes
typedef struct {
Lexer* lexer;
bool error; //I've had an error
bool panic; //I am processing an error
//track the last two outputs from the lexer
Token current;
Token previous;
} Parser;
void initParser(Parser* parser, Lexer* lexer);
void freeParser(Parser* parser);
Node* scanParser(Parser* parser);