diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-15 01:35:19 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-15 02:01:21 +0300 |
| commit | 5a728ae106b978c6de0fa6316f37eb3b4a86a405 (patch) | |
| tree | 20c5e1f08aa4c6c84f22d6b31d0965c36a38ab94 /src/parser.y | |
| parent | 8ce25e04620d4173748a7d7dd310351bac90eacc (diff) | |
| download | qbt-5a728ae106b978c6de0fa6316f37eb3b4a86a405.tar.gz qbt-5a728ae106b978c6de0fa6316f37eb3b4a86a405.zip | |
format
Diffstat (limited to 'src/parser.y')
| -rw-r--r-- | src/parser.y | 19 |
1 files changed, 12 insertions, 7 deletions
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 |
