41 lines
592 B
C
41 lines
592 B
C
#ifndef LEXER_H
|
|
#define LEXER_H
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include "list.h"
|
|
#include "tokenizer.h"
|
|
|
|
typedef enum {
|
|
PLUS,
|
|
MINUS,
|
|
STAR,
|
|
SLASH,
|
|
POWER,
|
|
LPARAM,
|
|
RPARAM,
|
|
LBRACKET,
|
|
RBracket,
|
|
COMMA,
|
|
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;
|
|
|
|
List* GetTokensFromLine(char*);
|
|
|
|
#endif |