Attempting to declutter the lexer and tokenizer by rereolling them into the 'Scanner' object.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#ifndef TOKEN_H
|
||||
#define TOKEN_H
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
typedef enum {
|
||||
PLUS,
|
||||
MINUS,
|
||||
STAR,
|
||||
SLASH,
|
||||
POWER,
|
||||
LPARAM,
|
||||
RPARAM,
|
||||
LBRACKET,
|
||||
RBracket,
|
||||
COMMA,
|
||||
STRING,
|
||||
IDENTIFIER,
|
||||
NUMBER,
|
||||
HEX,
|
||||
//Keywords
|
||||
DB, ORG,
|
||||
//Opcodes
|
||||
COPY, ADD, SUB, JZ, INT, YLD, RET,
|
||||
CMP, IN, OUT,
|
||||
//Registers
|
||||
R1, R2, R3, R4, R5, R6, R7, R8
|
||||
} TokenType;
|
||||
|
||||
typedef struct {
|
||||
TokenType type;
|
||||
char* value;
|
||||
} Token;
|
||||
|
||||
Token* CreateToken(TokenType type, char* value);
|
||||
void FreeToken(Token*);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user