85 lines
1.4 KiB
C
85 lines
1.4 KiB
C
// Kyler Olsen
|
|
// YREA SLS
|
|
// Lexer Header
|
|
// October 2025
|
|
|
|
#ifndef SLS_LEXER_H
|
|
#define SLS_LEXER_H
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
TOKEN_EOF,
|
|
TOKEN_IDENTIFIER,
|
|
TOKEN_INTEGER,
|
|
TOKEN_FLOAT,
|
|
TOKEN_DOUBLE,
|
|
TOKEN_STRING,
|
|
TOKEN_BOOLEAN,
|
|
TOKEN_ARRAY,
|
|
TOKEN_TOKEN_STRING,
|
|
TOKEN_TYPE_TUPLE,
|
|
} TokenType;
|
|
|
|
typedef enum {
|
|
INTEGER_I64,
|
|
INTEGER_I32,
|
|
INTEGER_I16,
|
|
INTEGER_I8,
|
|
INTEGER_U64,
|
|
INTEGER_U32,
|
|
INTEGER_U16,
|
|
INTEGER_U8,
|
|
} IntegerBuiltInType;
|
|
|
|
typedef struct {
|
|
const char *name;
|
|
size_t length;
|
|
uint8_t is_literal;
|
|
} Identifier;
|
|
|
|
typedef struct {
|
|
uint64_t value;
|
|
IntegerBuiltInType type;
|
|
} IntegerLiteral;
|
|
|
|
typedef struct {
|
|
const char *value;
|
|
size_t length;
|
|
} StringLiteral;
|
|
|
|
typedef struct {
|
|
// TODO
|
|
} ArrayLiteral;
|
|
|
|
typedef struct {
|
|
const Token *tokens;
|
|
size_t length;
|
|
} TokenString;
|
|
|
|
typedef struct {
|
|
// TODO
|
|
} TypeTuple;
|
|
|
|
typedef struct {
|
|
TokenType type;
|
|
union {
|
|
Identifier identifier;
|
|
IntegerLiteral integer_literal;
|
|
float float_literal;
|
|
double double_literal;
|
|
StringLiteral string_literal;
|
|
uint8_t boolean_literal;
|
|
ArrayLiteral array_literal;
|
|
TokenString token_string;
|
|
TypeTuple type_tuple;
|
|
};
|
|
} Token;
|
|
|
|
typedef struct TokenStream {
|
|
Token token;
|
|
struct TokenStream *next;
|
|
} TokenStream;
|
|
|
|
#endif // SLS_LEXER_H
|