43 lines
697 B
C
43 lines
697 B
C
#ifndef PARSER_H
|
|
#define PARSER_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "list.h"
|
|
#include "token.h"
|
|
#include "opcodes.h"
|
|
|
|
#define HIGHMEMORY 65535 //64KiB - 1 AKA 0xFFFF
|
|
|
|
typedef struct {
|
|
Token* token;
|
|
int length;
|
|
int address;
|
|
int resolved;
|
|
} Symbol;
|
|
|
|
typedef struct {
|
|
TokenType Mnemonic;
|
|
TokenClass ParameterOneType;
|
|
TokenClass ParameterTwoType;
|
|
|
|
union {
|
|
uint16_t Constant;
|
|
Symbol* Address;
|
|
} ParameterOne;
|
|
|
|
union {
|
|
uint16_t Constant;
|
|
Symbol* Address;
|
|
} ParameterTwo;
|
|
} IROpcode;
|
|
|
|
typedef struct {
|
|
List* Opcodes;
|
|
List* SymbolsTable;
|
|
} IRState;
|
|
|
|
IRState* ParseTokens(List*);
|
|
|
|
#endif |