slowly writing a lexer, literally not functional lmao

This commit is contained in:
SpookyDervish
2025-12-26 12:28:45 +11:00
parent 897cee96b3
commit d4ac0be316
7 changed files with 156 additions and 0 deletions

22
src/sylt/lexer.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef LEXER_H
#define LEXER_H
#include "token.h"
#include <stdbool.h>
typedef struct
{
int position;
int readPosition;
int lineNumber;
char currentChar;
char *source;
} Lexer;
Lexer initLexer(char *source);
void readChar(Lexer *lexer);
void skipWhitespace(Lexer *lexer);
Token nextToken(Lexer *lexer);
char *tokenToCStr(Token token);
#endif // !LEXER_H