From 52d8eda04d1e2e33bf4c09713d83360453cec435 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 9 Apr 2024 20:41:43 +0300 Subject: add blit to instructions --- src/lexer.l | 2 ++ src/parser.y | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lexer.l b/src/lexer.l index 75e2b09..35fc5a7 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -124,6 +124,8 @@ STRING \"(\\.|[^"\\])*\" "->" {return LEXTHINARROW;} ">>" {return LEXTO;} "<<" {return LEXFROM;} +"<<*" {return LEXBLIT;} +"^" {return LEXALLOC;} "i9" {return LEXI9;} "i27" {return LEXI27;} diff --git a/src/parser.y b/src/parser.y index c0653bd..24a2ebe 100644 --- a/src/parser.y +++ b/src/parser.y @@ -59,7 +59,9 @@ %token LEXTHINARROW "->" %token LEXTO ">>" %token LEXFROM "<<" +%token LEXBLIT "<<*" %token LEXSEMI ";" +%token LEXALLOC "^" %token LEXI9 "i9" %token LEXI27 "i27" @@ -370,9 +372,14 @@ mem /* really not a huge fan or 'reusing' the output slot... */ INSADD(STORE, $[type], noclass(), b, t, $[mem_off]); } + | id "<<*" int id { + struct val t = IDTOVAL($1); + struct val f = IDTOVAL($4); + INSADD(BLIT, NOTYPE, noclass(), t, f, $[int]); + } stack - : type id "=" "alloc" int { + : type id "=" "^" int { struct val t = IDALLOC($[id]); INSADD(ALLOC, $[type], t, noclass(), noclass(), $[int]); } -- cgit v1.3