diff options
| author | Elias Haugsbakk <[email protected]> | 2026-09-21 15:04:26 +0200 |
|---|---|---|
| committer | Elias Haugsbakk <[email protected]> | 2026-09-21 15:04:26 +0200 |
| commit | ef85091be57ecef84e97799d56b3d9c4600ca1c2 (patch) | |
| tree | a4dac67435e984e8a8f1b726f2960166552eff9c /src/main/java/no/eliashaugsbakk/kompilator/IRGeneration | |
| parent | e7720e2d9e1319712f85cb0527e17f1251bd7d2c (diff) | |
translate outward facing text to Norwegian
Diffstat (limited to 'src/main/java/no/eliashaugsbakk/kompilator/IRGeneration')
3 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerationException.java b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerationException.java index b6a7062..4fef546 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerationException.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerationException.java @@ -6,7 +6,7 @@ public class IRGenerationException extends RuntimeException { public IRGenerationException(Position position, String message) { String pos; if (position == null) { - pos = "unknown position"; + pos = "ukjent posisjon"; } else { pos = position.line() + ":" + position.column(); } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerator.java b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerator.java index c72db95..04e8564 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerator.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/IRGenerator.java @@ -35,7 +35,7 @@ public class IRGenerator { generateStatement(stmt); } if (Main.VERBOSE) { - IO.println("======= IRGenerator ======="); + IO.println("======= IR-generator ======="); ir.forEach(IO::println); IO.println("\n\n\n\n"); } @@ -57,7 +57,7 @@ public class IRGenerator { if (assignment.expression instanceof StringLiteral stringLiteral) { value = stringLiteral.value; } else { - throw new IRGenerationException(assignment.position, "Only strings are implemented"); + throw new IRGenerationException(assignment.position, "Bare strenger er implementert"); } ir.add(new Assign(assignment.identifier, value)); } @@ -67,7 +67,7 @@ public class IRGenerator { if (identifierDecl.initializer instanceof StringLiteral stringLiteral) { value = stringLiteral.value; } else { - throw new IRGenerationException(identifierDecl.position, "Unknown function: " + identifierDecl.initializer); + throw new IRGenerationException(identifierDecl.position, "Ukjent funksjon: " + identifierDecl.initializer); } ir.add(new Alloc(identifierDecl.identifier, identifierDecl.type.name(), identifierDecl.mutable, value)); @@ -77,7 +77,7 @@ public class IRGenerator { if (expr instanceof FunctionCall call) { generateFunctionCall(call); } else { - throw new IRGenerationException(expr.position, "Only expression which can stand alone are functions"); + throw new IRGenerationException(expr.position, "Bare funksjoner kan stå alene som uttrykk"); } } @@ -88,12 +88,12 @@ public class IRGenerator { fnCall.arguments.forEach(arg -> { if (arg instanceof StringLiteral stringLiteral) { String temp = "t" + tempCounter++; - ir.add(new Alloc(temp, "string", false, stringLiteral.value)); + ir.add(new Alloc(temp, "streng", false, stringLiteral.value)); arguments.add(temp); } else if (arg instanceof Identifier identifier) { arguments.add(identifier.name); } else { - throw new IRGenerationException(fnCall.position, "Unknown function: " + arg); + throw new IRGenerationException(fnCall.position, "Ukjent funksjon: " + arg); } }); diff --git a/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java index fd6e7b7..655597e 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/IRGeneration/Instructions/Alloc.java @@ -2,9 +2,9 @@ package no.eliashaugsbakk.kompilator.IRGeneration.Instructions; import org.jetbrains.annotations.NotNull; -// allocate a new variable: set x: string = "Hello"; mut y: string?; +// allocate a new variable: set x: streng = "Hello"; mut y: streng?; // -// Alloc("x", "string", false, "Hello") // Alloc("y", "string", true, "null") +// Alloc("x", "streng", false, "Hello") // Alloc("y", "streng", true, "null") public record Alloc(String name, String type, boolean mutable, String initializer) implements Instruction { @Override @NotNull |
