mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Lexer partially working
This commit is contained in:
21
source/parser.h
Normal file
21
source/parser.h
Normal 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);
|
||||
Reference in New Issue
Block a user