From b1f7b0cccc6986ca107d9eeb1c7d5e5e5a32dc49 Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Sun, 30 Apr 2023 03:11:00 -0300 Subject: gas: Compile variable expression with scope support This patch adds the variable compilation and uses a scope (a stack of map) to lookup for identities. Today we use a vector + ref_entry structs in order to achieve the scope implementation. The ref_entry lacks memory management, we are still no sure who will be the owner of the pointer. We also want to replace the scope a hashtable_t type as soon as we get one. Signed-off-by: Johnny Richard Co-authored-by: Carlos Maniero --- examples/variables.pipa | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 examples/variables.pipa (limited to 'examples') diff --git a/examples/variables.pipa b/examples/variables.pipa new file mode 100644 index 0000000..9c395ce --- /dev/null +++ b/examples/variables.pipa @@ -0,0 +1,7 @@ +main(): i32 { + a: i32 = 12; + b: i32 = 32; + c: i32 = 2 * (b + a); + d: i32 = (c - 33) + 1; + return d / 2; +} -- cgit v1.2.3