comment code for understanding
This commit is contained in:
parent
43dd6be707
commit
ba1b614fc1
@ -37,7 +37,8 @@ int writeBinaryFile(word instrs[], char outputFile[]){
|
||||
}
|
||||
|
||||
|
||||
//reads assembly file of "inputFile" name,
|
||||
//reads assembly file of "inputFile" name, and passes
|
||||
//each line into a parser
|
||||
int readAssemblyFile(char inputFile[]) {
|
||||
if (!isValidFileFormat(filename, "s")){
|
||||
exit(EXIT_FAILURE);
|
||||
@ -53,7 +54,9 @@ int readAssemblyFile(char inputFile[]) {
|
||||
}
|
||||
|
||||
while (fgets(savedLine, MAX_ASM_LINE_LENGTH-1, fp) != NULL) {
|
||||
//pass line to parser
|
||||
// removes newline char before saving them
|
||||
savedLine[strcspn(savedLine, "\n")] = 0;
|
||||
|
||||
}
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
14
src/parser.c
14
src/parser.c
@ -1,11 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <parser.h>
|
||||
#include "parser.h"
|
||||
|
||||
#include <a64instruction.h>
|
||||
#include "a64instruction.h"
|
||||
|
||||
//takes input string, read from asm file and returns
|
||||
//input as an a64 instruction
|
||||
|
||||
//TODO:
|
||||
// - use string matching to get opcode, and operands
|
||||
// - check operand count
|
||||
// - match opcode to a64 struct types
|
||||
// - count operands and match type/values
|
||||
// - generate final a64inst and return
|
||||
|
||||
a64inst_instruction parser(char asmLine[]){
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user