29 lines
546 B
C
29 lines
546 B
C
#ifndef OPCODES_H
|
|
#define OPCODES_H
|
|
|
|
#include <string.h>
|
|
#include "token.h"
|
|
|
|
#define OPCODECOUNT 11
|
|
#define REGISTERCOUNT 8
|
|
|
|
typedef struct {
|
|
char* lexeme;
|
|
TokenType op;
|
|
TokenClass parameter_one;
|
|
TokenClass parameter_two;
|
|
} Instruction;
|
|
|
|
typedef struct {
|
|
char* lexeme;
|
|
TokenType type;
|
|
} Register;
|
|
|
|
extern Instruction instructions[OPCODECOUNT];
|
|
extern Register registers[REGISTERCOUNT];
|
|
|
|
int IsOpcode(const char*, TokenType*);
|
|
int IsRegister(const char*, TokenType*);
|
|
const Instruction* GetOpcodeDetails(TokenType);
|
|
|
|
#endif |