From c84b76d3848b089cbdd5650b894067fbf6060161 Mon Sep 17 00:00:00 2001 From: Elias Haugsbakk Date: Sun, 20 Sep 2026 23:02:49 +0200 Subject: Implement the record interpretation in asm construction and implement variables --- .../kompilator/IRGeneration/Instructions/Alloc.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java (limited to 'src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java') diff --git a/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java new file mode 100644 index 0000000..cda3a56 --- /dev/null +++ b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java @@ -0,0 +1,12 @@ +package no.eliashaugsbakk.kompilator.IRGeneration.Instructions; + +// allocate a new variable: set x: string = "Hello"; mut y: string?; +// +// Alloc("x", "string", false, "Hello") // Alloc("y", "string", true, "null") +public record Alloc(String name, String type, boolean mutable, String initializer) implements Instruction { + @Override + public String toString() { + return "Alloc[name=" + name + ", type=" + type + ", mutable=" + mutable + ", initializer=\"" + + initializer + "\"]"; + } +} -- cgit v1.2.3