diff --git a/src/main/java/edu/kit/kastel/vads/compiler/parser/Parser.java b/src/main/java/edu/kit/kastel/vads/compiler/parser/Parser.java index 57c9de8..f62d127 100644 --- a/src/main/java/edu/kit/kastel/vads/compiler/parser/Parser.java +++ b/src/main/java/edu/kit/kastel/vads/compiler/parser/Parser.java @@ -50,6 +50,9 @@ public class Parser { private FunctionTree parseFunction() { Keyword returnType = this.tokenSource.expectKeyword(KeywordType.INT); Identifier identifier = this.tokenSource.expectIdentifier(); + if (!identifier.value().equals("main")) { + throw new ParseException("expected main function but got " + identifier); + } this.tokenSource.expectSeparator(SeparatorType.PAREN_OPEN); this.tokenSource.expectSeparator(SeparatorType.PAREN_CLOSE); BlockTree body = parseBlock();