From 8b192bf02e224e944e9e5ef258814038a048ba38 Mon Sep 17 00:00:00 2001 From: Sam Hadow Date: Fri, 29 Mar 2024 22:35:48 +0100 Subject: [PATCH] fixed register ref in grammar --- src/ram.y | 2 +- src/test.asm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ram.y b/src/ram.y index 961a8d2..130471c 100644 --- a/src/ram.y +++ b/src/ram.y @@ -97,7 +97,7 @@ arg: REGISTER_REF { char* tmp = ""; char *index_str = strdup($1 + 3); // copy from 4th char - asprintf(&tmp, "('%c', '%c', '%c', %s)", $1[1], index_str, $1[2], $1[0]); + asprintf(&tmp, "('%c', %s, '%c', '%c')", $1[1], index_str, $1[2], $1[0]); // r@i1 -> r register, index in i1 // Python args: type_register, index, ref_origin, ref_target // r@i1 -> ('@', '1', 'i', 'r') diff --git a/src/test.asm b/src/test.asm index 41355d8..f462442 100644 --- a/src/test.asm +++ b/src/test.asm @@ -2,3 +2,4 @@ ADD(i0 ,1 ,r0) SUB(i1,3,r1) MULT(r1,r0,o1) +ADD(5, i@i2, o2)