diff options
| author | Elias Haugsbakk <[email protected]> | 2026-09-20 23:02:49 +0200 |
|---|---|---|
| committer | Elias Haugsbakk <[email protected]> | 2026-09-20 23:02:49 +0200 |
| commit | c84b76d3848b089cbdd5650b894067fbf6060161 (patch) | |
| tree | 6f3911f2416725b1e5f6dbb393f542dd8afb5526 /src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java | |
| parent | 79fc3dd706b968a9249dfd2db6b5175e4e4a85d4 (diff) | |
Implement the record interpretation in asm construction and implement variables
Diffstat (limited to 'src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java')
| -rw-r--r-- | src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java | 12 |
1 files changed, 12 insertions, 0 deletions
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 + "\"]"; + } +} |
