From ef85091be57ecef84e97799d56b3d9c4600ca1c2 Mon Sep 17 00:00:00 2001 From: Elias Haugsbakk Date: Mon, 21 Sep 2026 15:04:26 +0200 Subject: translate outward facing text to Norwegian --- .../kompilator/IO/FileReaderWriter.java | 6 ++-- .../kompilator/IO/FileReaderWriterException.java | 2 +- .../IRGeneration/IRGenerationException.java | 2 +- .../kompilator/IRGeneration/IRGenerator.java | 12 +++---- .../IRGeneration/Instructions/Alloc.java | 4 +-- .../java/no/eliashaugsbakk/kompilator/Main.java | 6 ++-- .../kompilator/asmGeneration/AssemblyBuilder.java | 12 +++---- .../assembleAndLink/AssemblerAndLinker.java | 14 ++++---- .../eliashaugsbakk/kompilator/parsing/Parser.java | 28 ++++++++-------- .../kompilator/parsing/ParserException.java | 2 +- .../kompilator/semanticAnalysis/Analyzer.java | 38 +++++++++++----------- .../semanticAnalysis/SemanticException.java | 2 +- .../kompilator/tokenization/Lexer.java | 4 +-- .../kompilator/tokenization/LexerState.java | 2 +- .../kompilator/tokenization/TokenType.java | 4 +-- 15 files changed, 69 insertions(+), 69 deletions(-) (limited to 'src/main/java/no') diff --git a/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriter.java b/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriter.java index b25b719..f4f7bbe 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriter.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriter.java @@ -17,7 +17,7 @@ public class FileReaderWriter { String fileBody = Files.readString(path); return new File(fileName, fileBody); } catch (IOException e) { - throw new FileReaderWriterException("Failed to read file: " + inputFilePath, e); + throw new FileReaderWriterException("Kunne ikke lese filen: " + inputFilePath, e); } } @@ -25,7 +25,7 @@ public class FileReaderWriter { try { Files.writeString(Path.of(file.fileName()), file.fileBody()); } catch (IOException e) { - throw new FileReaderWriterException("Failed to write file: " + file.fileName(), e); + throw new FileReaderWriterException("Kunne ikke skrive filen: " + file.fileName(), e); } } @@ -33,7 +33,7 @@ public class FileReaderWriter { try { Files.delete(Path.of(filePath)); } catch (IOException e) { - throw new FileReaderWriterException("Could not delete file: " + filePath, e); + throw new FileReaderWriterException("Kunne ikke slette filen: " + filePath, e); } } } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriterException.java b/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriterException.java index 1cc5bb8..fb38408 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriterException.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/IO/FileReaderWriterException.java @@ -2,6 +2,6 @@ package no.eliashaugsbakk.kompilator.IO; public class FileReaderWriterException extends Exception { public FileReaderWriterException(String message, Exception e) { - super("FileReaderWriter: " + message, e); + super("Filhåndtering: " + message, e); } } 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 diff --git a/src/main/java/no/eliashaugsbakk/kompilator/Main.java b/src/main/java/no/eliashaugsbakk/kompilator/Main.java index 512682c..62a93c7 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/Main.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/Main.java @@ -24,7 +24,7 @@ public class Main { static void main(String[] args) { if (args.length == 0) { - IO.println("err: File path must be specified."); + IO.println("feil: Filsti må angis."); System.exit(1); } @@ -34,7 +34,7 @@ public class Main { String inputFileName = args[0]; if (!inputFileName.endsWith("." + programFileExtension)) { - IO.println("err: Input file must use the file extension: " + programFileExtension); + IO.println("feil: Inndatafilen må ha filendelsen: " + programFileExtension); System.exit(1); } @@ -43,7 +43,7 @@ public class Main { try { inputProgram = fileReaderWriter.readFile(inputFileName); } catch (FileReaderWriterException e) { - IO.println("err: Could not read input file: " + inputFileName + "\n\n" + e.getMessage()); + IO.println("feil: Kunne ikke lese inndatafilen: " + inputFileName + "\n\n" + e.getMessage()); System.exit(1); } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/asmGeneration/AssemblyBuilder.java b/src/main/java/no/eliashaugsbakk/kompilator/asmGeneration/AssemblyBuilder.java index 7137e82..42fbefa 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/asmGeneration/AssemblyBuilder.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/asmGeneration/AssemblyBuilder.java @@ -87,7 +87,7 @@ public class AssemblyBuilder { this.bss.append(String.format(""" %s: .skip 8 """, alloc.name())); - } else if (alloc.type().equals("string")) { + } else if (alloc.type().equals("streng")) { String pointer = alloc.name() + "_ptr"; this.rodata.append(String.format(""" %s: .ascii "%s" @@ -96,17 +96,17 @@ public class AssemblyBuilder { %s: .quad %s """, alloc.name(), pointer)); } else { - throw new AssemblyBuilderException("Not a supported type"); + throw new AssemblyBuilderException("Typen støttes ikke"); } } private void handleAllocRO(Alloc alloc) { - if (alloc.type().equals("string")) { + if (alloc.type().equals("streng")) { this.rodata.append(String.format(""" %s: .ascii "%s" """, alloc.name(), alloc.initializer())); } else { - throw new AssemblyBuilderException("Not a supported type to skriv"); + throw new AssemblyBuilderException("Typen støttes ikke av skriv"); } } @@ -114,13 +114,13 @@ public class AssemblyBuilder { if (call.fn().equals("skriv")) { handlePrint(call); } else { - throw new AssemblyBuilderException("unknown call type: " + call.fn()); + throw new AssemblyBuilderException("Ukjent kalltype: " + call.fn()); } } void handlePrint(Call call) { if (call.args().size() != 1) { - throw new AssemblyBuilderException("Print only supports one argument"); + throw new AssemblyBuilderException("Utskrift støtter bare ett argument"); } String variableName = call.args().getFirst(); StringVar var = this.stringVariables.get(variableName); diff --git a/src/main/java/no/eliashaugsbakk/kompilator/assembleAndLink/AssemblerAndLinker.java b/src/main/java/no/eliashaugsbakk/kompilator/assembleAndLink/AssemblerAndLinker.java index cbf6f5e..42fe1c3 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/assembleAndLink/AssemblerAndLinker.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/assembleAndLink/AssemblerAndLinker.java @@ -22,7 +22,7 @@ public class AssemblerAndLinker { try { fileReaderWriter.writeFile(new File(assemblyFileName, assembly)); } catch (FileReaderWriterException e) { - IO.println("err: Could not write file: " + e.getMessage()); + IO.println("feil: Kunne ikke skrive filen: " + e.getMessage()); } try { @@ -30,9 +30,9 @@ public class AssemblerAndLinker { ProcessBuilder asPB = new ProcessBuilder("as", "-o", assembledFileName, assemblyFileName); runProcess(asPB); } catch (IOException e) { - IO.println("err: Failed to invoke GCC\n\n" + e); + IO.println("feil: Kunne ikke starte GCC\n\n" + e); } catch (InterruptedException e) { - IO.println("err: Failed to wait for gcc output\n\n" + e); + IO.println("feil: Kunne ikke vente på GCC-utdata\n\n" + e); } try { @@ -40,9 +40,9 @@ public class AssemblerAndLinker { ProcessBuilder ldPB = new ProcessBuilder("ld", "-o", programName, assembledFileName); runProcess(ldPB); } catch (IOException e) { - IO.println("err: Failed to invoke GCC\n\n" + e); + IO.println("feil: Kunne ikke starte GCC\n\n" + e); } catch (InterruptedException e) { - IO.println("err: Failed to wait for gcc output\n\n" + e); + IO.println("feil: Kunne ikke vente på GCC-utdata\n\n" + e); } // Clean up @@ -50,12 +50,12 @@ public class AssemblerAndLinker { try { fileReaderWriter.deleteFile(assemblyFileName); } catch (FileReaderWriterException e) { - IO.println("err: Could not delete assembly file: " + e.getMessage()); + IO.println("feil: Kunne ikke slette assemblerfilen: " + e.getMessage()); } try { fileReaderWriter.deleteFile(assembledFileName); } catch (FileReaderWriterException e) { - IO.println("err: Could not delete assembled file: " + e.getMessage()); + IO.println("feil: Kunne ikke slette objektfilen: " + e.getMessage()); } } } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/parsing/Parser.java b/src/main/java/no/eliashaugsbakk/kompilator/parsing/Parser.java index 45eca22..1f65b38 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/parsing/Parser.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/parsing/Parser.java @@ -78,8 +78,8 @@ public class Parser { private Statement parseStatement() throws ParserException { // multiple statements are supported for v0.0.2; - // identifier declaration: x: string = "hello"; (with expression) - // identifier declaration: x: string; (without expression) + // identifier declaration: x: streng = "hello"; (with expression) + // identifier declaration: x: streng; (without expression) // assignment: x = "hello"; (identifier gets assigned an expression) // expression statements: print(x); (function without a return value) @@ -102,7 +102,7 @@ public class Parser { // must be some other token which is not a statement else { - throw new ParserException(token.position(), "Unexpected token: " + token.value()); + throw new ParserException(token.position(), "Uventet symbol: " + token.value()); } } @@ -117,7 +117,7 @@ public class Parser { } else if (token.value().contentEquals("skriv")) { return parseExpressionStatement(); } else { - throw new ParserException(token.position(), "unknown keyword: " + token.value()); + throw new ParserException(token.position(), "Ukjent nøkkelord: " + token.value()); } } @@ -148,7 +148,7 @@ public class Parser { expectSemicolon(); return new ExpressionStatement(expr.position, expr); } else { - throw new ParserException(next.position(), "Unexpected token after identifier: " + next.value()); + throw new ParserException(next.position(), "Uventet symbol etter identifikator: " + next.value()); } } @@ -156,14 +156,14 @@ public class Parser { Token nameToken = tokens.get(current); if (nameToken.type() != IDENTIFIER) { throw new ParserException(nameToken.position(), - "Expected identifier after declaration keyword, got: " + nameToken.value()); + "Forventet identifikator etter deklarasjonsnøkkelord, fikk: " + nameToken.value()); } String identifier = nameToken.value(); current++; // consume identifier if (tokens.get(current).type() != COLON) { throw new ParserException(tokens.get(current).position(), - "Expected : after identifier in declaration"); + "Forventet : etter identifikator i deklarasjonen"); } current++; // skip : @@ -193,7 +193,7 @@ public class Parser { Token token = tokens.get(current); if (token.type() != TYPE) { throw new ParserException(token.position(), - "Expected type, got: " + token.value()); + "Forventet type, fikk: " + token.value()); } current++; @@ -211,7 +211,7 @@ public class Parser { private Expression parseExpression() throws ParserException { // an expression produces a value and may contain other expressions // implemented for v0.0.2 are: - // "string" - STRING_LITERAL + // "streng" - STRING_LITERAL // my_var - IDENTIFIER Token token = tokens.get(current); @@ -228,7 +228,7 @@ public class Parser { return new Identifier(token.position(), token.value()); } else { throw new ParserException(token.position(), - "Unexpected token: " + token.value() + ". Expected an expression"); + "Uventet symbol: " + token.value() + ". Forventet et uttrykk"); } } @@ -245,7 +245,7 @@ public class Parser { if (tokens.get(current).type() != LPAREN) { throw new ParserException(tokens.get(current).position(), - "Expected ("); + "Forventet ("); } current++; // skip ( @@ -259,7 +259,7 @@ public class Parser { if (current >= tokens.size() || tokens.get(current).type() != RPAREN) { throw new ParserException(tokens.get(current).position(), - "Expected )"); + "Forventet )"); } current++; // skip ) @@ -268,10 +268,10 @@ public class Parser { private void expectSemicolon() throws ParserException { if (current >= tokens.size()) { - throw new ParserException(null, "Expected ;"); + throw new ParserException(null, "Forventet ;"); } else if (tokens.get(current).type() != SEMICOLON) { throw new ParserException(tokens.get(current).position(), - "Expected: ;"); + "Forventet: ;"); } current++; } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/parsing/ParserException.java b/src/main/java/no/eliashaugsbakk/kompilator/parsing/ParserException.java index 892cd7b..562094a 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/parsing/ParserException.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/parsing/ParserException.java @@ -6,7 +6,7 @@ public class ParserException extends Exception { public ParserException(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/semanticAnalysis/Analyzer.java b/src/main/java/no/eliashaugsbakk/kompilator/semanticAnalysis/Analyzer.java index f981527..2b4dbb9 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/semanticAnalysis/Analyzer.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/semanticAnalysis/Analyzer.java @@ -35,7 +35,7 @@ public class Analyzer { case ExpressionStatement exprStmt -> typeOf(exprStmt.expression); case Assignment assignment -> analyzeAssignment(assignment); case IdentifierDeclaration decl -> analyzeIdentifierDeclaration(decl); - default -> throw new SemanticException(stmt.position, "Unrecognized statement"); + default -> throw new SemanticException(stmt.position, "Ukjent programkonstruksjon"); } } @@ -49,20 +49,20 @@ public class Analyzer { // Ensure the type exists // string is the only type implemented, but should look in a type table or something in the future - if (!declaredType.name().equals("string")) { - throw new SemanticException(decl.position, "Unknown type declaration: " + declaredType.name()); + if (!declaredType.name().equals("streng")) { + throw new SemanticException(decl.position, "Ukjent type: " + declaredType.name()); } // Immutable variables must always be initialized on declaration if (!decl.mutable && !initialized) { throw new SemanticException(decl.position, - "Immutable variable " + decl.identifier + " must be initialized upon declaration."); + "Uforanderlig variabel " + decl.identifier + " må initialiseres ved deklarasjon."); } // If no initializer, ensure type is nullable if (!initialized && !nullable) { throw new SemanticException(decl.position, - "Non-nullable type requires initialization"); + "En type som ikke kan være null, må initialiseres"); } // If initializer exists, validate type matches declared type @@ -85,13 +85,13 @@ public class Analyzer { // Check existence if (symbol == null) { throw new SemanticException(assignment.position, - "Variable not declared: " + assignment.identifier); + "Variabelen er ikke deklarert: " + assignment.identifier); } // Check mutability if (!symbol.mutable) { throw new SemanticException(assignment.position, - "Cannot assign to immutable value: " + assignment.identifier); + "Kan ikke tilordne en uforanderlig verdi: " + assignment.identifier); } // Type and Nullability Check @@ -111,27 +111,27 @@ public class Analyzer { // Should ref. function table in the future if (!call.functionName.equals("skriv")) { throw new SemanticException(call.position, - "Function call is not supported: " + call.functionName); + "Funksjonskallet støttes ikke: " + call.functionName); } // Validate argument count if (call.arguments.size() != 1) { throw new SemanticException(call.position, - "skriv() supports only one argument"); + "skriv() støtter bare ett argument"); } // Validate argument types for (Expression argument : call.arguments) { Type argType = typeOf(argument); - if (!argType.name().equals("string")) { + if (!argType.name().equals("streng")) { throw new SemanticException(call.position, - "skriv() only supports string literals"); + "skriv() støtter bare strengliteraler"); } if (argType.nullable()) { throw new SemanticException(call.position, - "Cannot print nullable string: " + argType.name() + "?."); + "Kan ikke skrive ut en nullbar streng: " + argType.name() + "?."); } } } @@ -139,11 +139,11 @@ public class Analyzer { private void checkAssignable(Type target, Type value) throws SemanticException { if (!target.name().equals(value.name())) { throw new SemanticException(null, - "Type mismatch: expected " + target.name() + ", found " + value.name()); + "Typekonflikt: forventet " + target.name() + ", fant " + value.name()); } if (value.nullable() && !target.nullable()) { throw new SemanticException(null, - "Cannot assign nullable " + value.name() + " to non-nullable " + target.name()); + "Kan ikke tilordne nullbar " + value.name() + " til ikke-nullbar " + target.name()); } } @@ -153,18 +153,18 @@ public class Analyzer { */ private Type typeOf(Expression expr) throws SemanticException { switch (expr) { - case null -> throw new SemanticException(expr.position, "Expression cannot be null"); + case null -> throw new SemanticException(expr.position, "Uttrykket kan ikke være null"); case StringLiteral _ -> { - return new Type("string", false); + return new Type("streng", false); } case Identifier id -> { Symbol symbol = symbolTable.get(id.name); if (symbol == null) { - throw new SemanticException(expr.position, "Undeclared identifier: " + id.name); + throw new SemanticException(expr.position, "Udeklarert identifikator: " + id.name); } if (!symbol.initialized) { - throw new SemanticException(expr.position, "Identifier is not initialized: " + id.name); + throw new SemanticException(expr.position, "Identifikatoren er ikke initialisert: " + id.name); } return symbol.type; @@ -177,6 +177,6 @@ public class Analyzer { } } - throw new SemanticException(expr.position, "Unknown expression type: " + expr.getClass().getSimpleName()); + throw new SemanticException(expr.position, "Ukjent uttrykkstype: " + expr.getClass().getSimpleName()); } } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/semanticAnalysis/SemanticException.java b/src/main/java/no/eliashaugsbakk/kompilator/semanticAnalysis/SemanticException.java index d65a80d..7783fcc 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/semanticAnalysis/SemanticException.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/semanticAnalysis/SemanticException.java @@ -6,7 +6,7 @@ public class SemanticException extends Exception { public SemanticException(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/tokenization/Lexer.java b/src/main/java/no/eliashaugsbakk/kompilator/tokenization/Lexer.java index 517f0e5..b767190 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/tokenization/Lexer.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/tokenization/Lexer.java @@ -72,9 +72,9 @@ public class Lexer { position++; } - tokens.add(new Token(EOF, "End of File", new Position(line, column))); + tokens.add(new Token(EOF, "Filslutt", new Position(line, column))); if (Main.VERBOSE) { - IO.println("======= Lexer ======="); + IO.println("======= Leksikalsk analyse ======="); tokens.forEach(token -> IO.println(token.type().toString() + ": " + token.value())); IO.println("\n\n\n\n"); } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/tokenization/LexerState.java b/src/main/java/no/eliashaugsbakk/kompilator/tokenization/LexerState.java index deac767..f574394 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/tokenization/LexerState.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/tokenization/LexerState.java @@ -4,7 +4,7 @@ public enum LexerState { NORMAL, // reading regular tokens IN_STRING, // inside a string (after ") IN_WORD, // reading a keyword or identifier - IN_TYPE, // reading a type (i32, string, ...) + IN_TYPE, // reading a type (i32, streng, ...) IN_SINGLE_LINE_COMMENT, // reading a single line comment IN_MULTI_LINE_COMMENT, // reading a multi line comment } diff --git a/src/main/java/no/eliashaugsbakk/kompilator/tokenization/TokenType.java b/src/main/java/no/eliashaugsbakk/kompilator/tokenization/TokenType.java index 40b9d2e..f7a7da4 100644 --- a/src/main/java/no/eliashaugsbakk/kompilator/tokenization/TokenType.java +++ b/src/main/java/no/eliashaugsbakk/kompilator/tokenization/TokenType.java @@ -5,9 +5,9 @@ public enum TokenType { IDENTIFIER, // variable_1 STRING_LITERAL, // "Hello, World!" COLON, // : (set x[:] int = ...) - TYPE, // string, i32, i16?, my_type, ... (? makes nullable) + TYPE, // streng, i32, i16?, my_type, ... (? makes nullable) ASSIGN, // = - NULLABLE, // ? (x = string?;) + NULLABLE, // ? (x = streng?;) LPAREN, // ( RPAREN, // ) SEMICOLON, // ; -- cgit v1.2.3