rename parser funcs for clarity
This commit is contained in:
parent
036e163fe8
commit
cadac4e1bb
13
src/parser.c
13
src/parser.c
@ -8,13 +8,13 @@
|
||||
//input as an a64 instruction
|
||||
|
||||
//TODO:
|
||||
// - use string matching to get opcode, and operands
|
||||
// - check operand count
|
||||
// - use string matching to get opcode, and operands (DONE)
|
||||
// - check operand count (DONE)
|
||||
// - match opcode to a64 struct types
|
||||
// - count operands and match type/values
|
||||
// - generate final a64inst and return
|
||||
|
||||
char *splitOperands(char* str, int operandCount, char *operands[]){
|
||||
char *tokeniseOperands(char* str, int operandCount, char *operands[]){
|
||||
char *operandsDupe = strdup(str);
|
||||
int operandCount = 0;
|
||||
char *operand = strtok(operandsDupe, OPERAND_DELIMITER);
|
||||
@ -29,7 +29,7 @@ char *splitOperands(char* str, int operandCount, char *operands[]){
|
||||
|
||||
}
|
||||
|
||||
a64inst_instruction *tokeniser(char asmLine[]){
|
||||
a64inst_instruction *parser(char asmLine[]){
|
||||
a64inst_instruction *instr = malloc(sizeof(a64inst_instruction));
|
||||
if (instr == NULL){
|
||||
exit(EXIT_FAILURE);
|
||||
@ -49,8 +49,11 @@ a64inst_instruction *tokeniser(char asmLine[]){
|
||||
//type is instruction
|
||||
int operandCount = 0;
|
||||
const char *operandList[4];
|
||||
splitOperands(operands, &operandCount, operandList);
|
||||
tokeniseOperands(operands, &operandCount, operandList);
|
||||
|
||||
}
|
||||
|
||||
return(a64inst_instruction);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user