fixed register ref in grammar

This commit is contained in:
Sam Hadow 2024-03-29 22:35:48 +01:00
parent d8ed110400
commit 8b192bf02e
2 changed files with 2 additions and 1 deletions

View File

@ -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')

View File

@ -2,3 +2,4 @@
ADD(i0 ,1 ,r0)
SUB(i1,3,r1)
MULT(r1,r0,o1)
ADD(5, i@i2, o2)