A bit of cleanup.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "list.h"
|
||||
#include "token.h"
|
||||
#include "opcodes.h"
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
#include "../includes/parser.h"
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
Symbol* CreateSymbol(Token* token, int length, int address, int resolved);
|
||||
const List* TokensList;
|
||||
int CurrentToken = 0;
|
||||
|
||||
@@ -15,7 +10,6 @@ void AdvanceParser(void);
|
||||
void IgnoreParserLine(void);
|
||||
Token* PeekToken(void);
|
||||
int ParserAtEnd(void);
|
||||
int Expect(int, ...);
|
||||
IRState MachineState;
|
||||
|
||||
IRState* ParseTokens(List* tokens) {
|
||||
@@ -126,7 +120,6 @@ Parameter* GetParameterType() {
|
||||
else {
|
||||
fprintf(stderr, "[Error] Line %d: Expected identifier, constant number or register.\n", token->LineNumber);
|
||||
IgnoreParserLine();
|
||||
AdvanceParser(); //Consume NewLine
|
||||
//return NULL;
|
||||
exit(1);
|
||||
}
|
||||
@@ -174,7 +167,6 @@ void HandleOperation() {
|
||||
goto InsertInstruction;
|
||||
}
|
||||
|
||||
//ins->ParameterOne->ParameterType = GetParameterType(&token);
|
||||
ins->ParameterOne = GetParameterType();
|
||||
|
||||
if (ins->ParameterOne->ParameterType == NoParameter) {
|
||||
@@ -199,7 +191,6 @@ void HandleOperation() {
|
||||
|
||||
AdvanceParser(); //Consume the comma
|
||||
|
||||
//ins->ParameterTwo->ParameterType = GetParameterType(&token);
|
||||
ins->ParameterTwo = GetParameterType();
|
||||
|
||||
InsertInstruction:
|
||||
@@ -211,25 +202,6 @@ void HandleOperation() {
|
||||
free(ins);
|
||||
}
|
||||
|
||||
int Expect(int count, ...) {
|
||||
va_list list;
|
||||
Token* token = PeekToken();
|
||||
|
||||
va_start(list, count);
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
if (va_arg(list, TokenClass) == token->Class) {
|
||||
va_end(list);
|
||||
AdvanceParser();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
va_end(list);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PrintSymbols(void) {
|
||||
printf("-----SYMBOLS-----\n");
|
||||
for(int i = 0; i < MachineState.SymbolsTable->Size; i++) {
|
||||
|
||||
Reference in New Issue
Block a user