From e3d8e031c6f20c68f2227028ee8b3e73cd9b8161 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Mon, 1 May 2023 01:57:22 +0200 Subject: parser: Implement variable assignment This commit introduces variable assignment making it possible to change a variable value. Example: myvar: i32 = 1; myvar = 2; Signed-off-by: Johnny Richard Co-authored-by: Carlos Maniero --- examples/variables.pipa | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/variables.pipa') diff --git a/examples/variables.pipa b/examples/variables.pipa index 25cbd59..0723782 100644 --- a/examples/variables.pipa +++ b/examples/variables.pipa @@ -1,6 +1,8 @@ main(): i32 { - a: i32 = 12; - b: i32 = 32; + a: i32 = 13; + a = a - 1; + b: i32 = 33; + b = 32; c: i32 = 2 * (b + a); d: i32 = (c - 33) + 1; e: i32 = d; -- cgit v1.2.3