From 5a728ae106b978c6de0fa6316f37eb3b4a86a405 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 15 Apr 2024 01:35:19 +0300 Subject: format --- src/parser.y | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/parser.y') diff --git a/src/parser.y b/src/parser.y index 24a2ebe..609c777 100644 --- a/src/parser.y +++ b/src/parser.y @@ -362,15 +362,13 @@ mem_off mem : type id "<<" mem_base mem_off { - struct val t = IDTOVAL($[id]); + struct val t = IDALLOC($[id]); struct val b = IDTOVAL($[mem_base]); INSADD(LOAD, $[type], t, b, noclass(), $[mem_off]); } - | id ">>" type mem_base mem_off { - struct val t = IDTOVAL($[id]); + | arg ">>" type mem_base mem_off { struct val b = IDTOVAL($[mem_base]); - /* really not a huge fan or 'reusing' the output slot... */ - INSADD(STORE, $[type], noclass(), b, t, $[mem_off]); + INSADD(STORE, $[type], noclass(), b, $[arg], $[mem_off]); } | id "<<*" int id { struct val t = IDTOVAL($1); @@ -384,6 +382,10 @@ stack INSADD(ALLOC, $[type], t, noclass(), noclass(), $[int]); } + | "^" "^" int { + INSADD(DEALLOC, NOTYPE, noclass(), noclass(), noclass(), $[int]); + } + cond : type id "=" arg "==" arg { struct val t = IDALLOC($[id]); @@ -480,8 +482,8 @@ opt_call_rets | {} call_arg - : type arg { - INSADD(ARG, $[type], noclass(), $[arg], imm_val(parser->idx++, I27), 0); + : arg { + INSADD(ARG, NOTYPE, noclass(), $[arg], imm_val(parser->idx++, I27), 0); } call_args @@ -568,6 +570,9 @@ top unit : top unit | top + | error { + parser->failed = true; + } input : unit -- cgit v1.3