diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index 4fd796d..e9441bb 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -1,4 +1,3 @@ eclipse.preferences.version=1 encoding//src/main/java=UTF-8 -encoding//target/generated-sources/antlr4=UTF-8 encoding/=UTF-8 diff --git a/pom.xml b/pom.xml index e549dfc..1dba529 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,8 @@ http://maven.apache.org UTF-8 + true + false diff --git a/src/main/java/de/hsrm/compiler/Klang/EvalVisitor.java b/src/main/java/de/hsrm/compiler/Klang/EvalVisitor.java new file mode 100644 index 0000000..2083b30 --- /dev/null +++ b/src/main/java/de/hsrm/compiler/Klang/EvalVisitor.java @@ -0,0 +1,227 @@ +package de.hsrm.compiler.Klang; + +import org.antlr.v4.runtime.misc.NotNull; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class EvalVisitor extends KlangBaseVisitor { + + // used to compare floating point numbers + public static final double SMALL_VALUE = 0.00000000001; + + // store variables (there's only one global scope!) + private Map memory = new HashMap(); + + // assignment/id overrides + @Override + public Value visitAssignment(KlangParser.AssignmentContext ctx) { + String id = ctx.ID().getText(); + Value value = this.visit(ctx.expr()); + return memory.put(id, value); + } + + @Override + public Value visitIdAtom(KlangParser.IdAtomContext ctx) { + String id = ctx.getText(); + Value value = memory.get(id); + if(value == null) { + throw new RuntimeException("no such variable: " + id); + } + return value; + } + + // atom overrides + @Override + public Value visitStringAtom(KlangParser.StringAtomContext ctx) { + String str = ctx.getText(); + // strip quotes + str = str.substring(1, str.length() - 1).replace("\"\"", "\""); + return new Value(str); + } + + @Override + public Value visitNumberAtom(KlangParser.NumberAtomContext ctx) { + return new Value(Double.valueOf(ctx.getText())); + } + + @Override + public Value visitBooleanAtom(KlangParser.BooleanAtomContext ctx) { + return new Value(Boolean.valueOf(ctx.getText())); + } + + @Override + public Value visitNilAtom(KlangParser.NilAtomContext ctx) { + return new Value(null); + } + + // expr overrides + @Override + public Value visitParExpr(KlangParser.ParExprContext ctx) { + return this.visit(ctx.expr()); + } + + @Override + public Value visitPowExpr(KlangParser.PowExprContext ctx) { + Value left = this.visit(ctx.expr(0)); + Value right = this.visit(ctx.expr(1)); + return new Value(Math.pow(left.asDouble(), right.asDouble())); + } + + @Override + public Value visitUnaryMinusExpr(KlangParser.UnaryMinusExprContext ctx) { + Value value = this.visit(ctx.expr()); + return new Value(-value.asDouble()); + } + + @Override + public Value visitNotExpr(KlangParser.NotExprContext ctx) { + Value value = this.visit(ctx.expr()); + return new Value(!value.asBoolean()); + } + + @Override + public Value visitMultiplicationExpr(@NotNull KlangParser.MultiplicationExprContext ctx) { + + Value left = this.visit(ctx.expr(0)); + Value right = this.visit(ctx.expr(1)); + + switch (ctx.op.getType()) { + case KlangParser.MULT: + return new Value(left.asDouble() * right.asDouble()); + case KlangParser.DIV: + return new Value(left.asDouble() / right.asDouble()); + case KlangParser.MOD: + return new Value(left.asDouble() % right.asDouble()); + default: + throw new RuntimeException("unknown operator: " + KlangParser.tokenNames[ctx.op.getType()]); + } + } + + @Override + public Value visitAdditiveExpr(@NotNull KlangParser.AdditiveExprContext ctx) { + + Value left = this.visit(ctx.expr(0)); + Value right = this.visit(ctx.expr(1)); + + switch (ctx.op.getType()) { + case KlangParser.PLUS: + return left.isDouble() && right.isDouble() ? + new Value(left.asDouble() + right.asDouble()) : + new Value(left.asString() + right.asString()); + case KlangParser.MINUS: + return new Value(left.asDouble() - right.asDouble()); + default: + throw new RuntimeException("unknown operator: " + KlangParser.tokenNames[ctx.op.getType()]); + } + } + + @Override + public Value visitRelationalExpr(@NotNull KlangParser.RelationalExprContext ctx) { + + Value left = this.visit(ctx.expr(0)); + Value right = this.visit(ctx.expr(1)); + + switch (ctx.op.getType()) { + case KlangParser.LT: + return new Value(left.asDouble() < right.asDouble()); + case KlangParser.LTEQ: + return new Value(left.asDouble() <= right.asDouble()); + case KlangParser.GT: + return new Value(left.asDouble() > right.asDouble()); + case KlangParser.GTEQ: + return new Value(left.asDouble() >= right.asDouble()); + default: + throw new RuntimeException("unknown operator: " + KlangParser.tokenNames[ctx.op.getType()]); + } + } + + @Override + public Value visitEqualityExpr(@NotNull KlangParser.EqualityExprContext ctx) { + + Value left = this.visit(ctx.expr(0)); + Value right = this.visit(ctx.expr(1)); + + switch (ctx.op.getType()) { + case KlangParser.EQ: + return left.isDouble() && right.isDouble() ? + new Value(Math.abs(left.asDouble() - right.asDouble()) < SMALL_VALUE) : + new Value(left.equals(right)); + case KlangParser.NEQ: + return left.isDouble() && right.isDouble() ? + new Value(Math.abs(left.asDouble() - right.asDouble()) >= SMALL_VALUE) : + new Value(!left.equals(right)); + default: + throw new RuntimeException("unknown operator: " + KlangParser.tokenNames[ctx.op.getType()]); + } + } + + @Override + public Value visitAndExpr(KlangParser.AndExprContext ctx) { + Value left = this.visit(ctx.expr(0)); + Value right = this.visit(ctx.expr(1)); + return new Value(left.asBoolean() && right.asBoolean()); + } + + @Override + public Value visitOrExpr(KlangParser.OrExprContext ctx) { + Value left = this.visit(ctx.expr(0)); + Value right = this.visit(ctx.expr(1)); + return new Value(left.asBoolean() || right.asBoolean()); + } + + // log override + @Override + public Value visitLog(KlangParser.LogContext ctx) { + Value value = this.visit(ctx.expr()); + System.out.println(value); + return value; + } + + // if override + @Override + public Value visitIf_stat(KlangParser.If_statContext ctx) { + + List conditions = ctx.condition_block(); + + boolean evaluatedBlock = false; + + for(KlangParser.Condition_blockContext condition : conditions) { + + Value evaluated = this.visit(condition.expr()); + + if(evaluated.asBoolean()) { + evaluatedBlock = true; + // evaluate this block whose expr==true + this.visit(condition.stat_block()); + break; + } + } + + if(!evaluatedBlock && ctx.stat_block() != null) { + // evaluate the else-stat_block (if present == not null) + this.visit(ctx.stat_block()); + } + + return Value.VOID; + } + + // while override + @Override + public Value visitWhile_stat(KlangParser.While_statContext ctx) { + + Value value = this.visit(ctx.expr()); + + while(value.asBoolean()) { + + // evaluate the code block + this.visit(ctx.stat_block()); + + // evaluate the expression + value = this.visit(ctx.expr()); + } + + return Value.VOID; + } +} \ No newline at end of file diff --git a/src/main/java/de/hsrm/compiler/Klang/Klang.java b/src/main/java/de/hsrm/compiler/Klang/Klang.java index a25a865..69ffe2c 100644 --- a/src/main/java/de/hsrm/compiler/Klang/Klang.java +++ b/src/main/java/de/hsrm/compiler/Klang/Klang.java @@ -19,6 +19,7 @@ public class Klang { KlangParser parser = new KlangParser(tokens); ParseTree tree = parser.parse(); // begin parsing at init rule - System.out.println(tree.toStringTree(parser)); // print LISP-style tree + EvalVisitor visitor = new EvalVisitor(); + visitor.visit(tree); } } diff --git a/src/main/java/de/hsrm/compiler/Klang/Value.java b/src/main/java/de/hsrm/compiler/Klang/Value.java new file mode 100644 index 0000000..c0d6a39 --- /dev/null +++ b/src/main/java/de/hsrm/compiler/Klang/Value.java @@ -0,0 +1,59 @@ +package de.hsrm.compiler.Klang; + +public class Value { + + public static Value VOID = new Value(new Object()); + + final Object value; + + public Value(Object value) { + this.value = value; + } + + public Boolean asBoolean() { + return (Boolean)value; + } + + public Double asDouble() { + return (Double)value; + } + + public String asString() { + return String.valueOf(value); + } + + public boolean isDouble() { + return value instanceof Double; + } + + @Override + public int hashCode() { + + if(value == null) { + return 0; + } + + return this.value.hashCode(); + } + + @Override + public boolean equals(Object o) { + + if(value == o) { + return true; + } + + if(value == null || o == null || o.getClass() != value.getClass()) { + return false; + } + + Value that = (Value)o; + + return this.value.equals(that.value); + } + + @Override + public String toString() { + return String.valueOf(value); + } +} diff --git a/target/classes/de/hsrm/compiler/Klang/EvalVisitor.class b/target/classes/de/hsrm/compiler/Klang/EvalVisitor.class new file mode 100644 index 0000000..ec4f25b Binary files /dev/null and b/target/classes/de/hsrm/compiler/Klang/EvalVisitor.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/Klang.class b/target/classes/de/hsrm/compiler/Klang/Klang.class index c768ae7..897e220 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/Klang.class and b/target/classes/de/hsrm/compiler/Klang/Klang.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangBaseListener.class b/target/classes/de/hsrm/compiler/Klang/KlangBaseListener.class deleted file mode 100644 index eee285d..0000000 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangBaseListener.class and /dev/null differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangBaseVisitor.class b/target/classes/de/hsrm/compiler/Klang/KlangBaseVisitor.class new file mode 100644 index 0000000..59ff9ef Binary files /dev/null and b/target/classes/de/hsrm/compiler/Klang/KlangBaseVisitor.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangListener.class b/target/classes/de/hsrm/compiler/Klang/KlangListener.class deleted file mode 100644 index 637f9fd..0000000 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangListener.class and /dev/null differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$AdditiveExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$AdditiveExprContext.class index 7d6bc9c..d9ab57f 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$AdditiveExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$AdditiveExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$AndExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$AndExprContext.class index eff5b74..84343ac 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$AndExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$AndExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$AssignmentContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$AssignmentContext.class index b5c022d..3218d89 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$AssignmentContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$AssignmentContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomContext.class index a359874..354dd48 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomExprContext.class index 208c224..ebfebce 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$AtomExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$BlockContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$BlockContext.class index 0f2da33..2a0309c 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$BlockContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$BlockContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$BooleanAtomContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$BooleanAtomContext.class index be8756e..7ac0694 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$BooleanAtomContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$BooleanAtomContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$Condition_blockContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$Condition_blockContext.class index 0a7c4bd..9e8d31b 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$Condition_blockContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$Condition_blockContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$EqualityExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$EqualityExprContext.class index a728197..223ecdf 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$EqualityExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$EqualityExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$ExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$ExprContext.class index 6b9d04a..196380c 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$ExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$ExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$IdAtomContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$IdAtomContext.class index d250fd9..5faa7ad 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$IdAtomContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$IdAtomContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$If_statContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$If_statContext.class index 26b3837..f4ad250 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$If_statContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$If_statContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$LogContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$LogContext.class index b18b0ea..0b0571c 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$LogContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$LogContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$MultiplicationExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$MultiplicationExprContext.class index 1a19478..1ce4bc3 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$MultiplicationExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$MultiplicationExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$NilAtomContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$NilAtomContext.class index fe6ed1e..e493d4b 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$NilAtomContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$NilAtomContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$NotExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$NotExprContext.class index 4453017..c28e9a3 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$NotExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$NotExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$NumberAtomContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$NumberAtomContext.class index e771d1c..62b897b 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$NumberAtomContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$NumberAtomContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$OrExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$OrExprContext.class index ad94fe9..e72b3d3 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$OrExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$OrExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$ParExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$ParExprContext.class index 7de1dfc..53cd00a 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$ParExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$ParExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$ParseContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$ParseContext.class index 8e0c250..1e3a90d 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$ParseContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$ParseContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$PowExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$PowExprContext.class index 2167fc1..d449d86 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$PowExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$PowExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$RelationalExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$RelationalExprContext.class index 64a5a7e..1099149 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$RelationalExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$RelationalExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$StatContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$StatContext.class index b42d807..dac3938 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$StatContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$StatContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$Stat_blockContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$Stat_blockContext.class index e60e649..70b2cb9 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$Stat_blockContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$Stat_blockContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$StringAtomContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$StringAtomContext.class index 15f7cff..cdbc7ec 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$StringAtomContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$StringAtomContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$UnaryMinusExprContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$UnaryMinusExprContext.class index e52b303..7e53d68 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$UnaryMinusExprContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$UnaryMinusExprContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser$While_statContext.class b/target/classes/de/hsrm/compiler/Klang/KlangParser$While_statContext.class index 70a454b..226b9a6 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser$While_statContext.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser$While_statContext.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangParser.class b/target/classes/de/hsrm/compiler/Klang/KlangParser.class index cd696b5..c180c0b 100644 Binary files a/target/classes/de/hsrm/compiler/Klang/KlangParser.class and b/target/classes/de/hsrm/compiler/Klang/KlangParser.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/KlangVisitor.class b/target/classes/de/hsrm/compiler/Klang/KlangVisitor.class new file mode 100644 index 0000000..333c1c3 Binary files /dev/null and b/target/classes/de/hsrm/compiler/Klang/KlangVisitor.class differ diff --git a/target/classes/de/hsrm/compiler/Klang/Value.class b/target/classes/de/hsrm/compiler/Klang/Value.class new file mode 100644 index 0000000..505dfae Binary files /dev/null and b/target/classes/de/hsrm/compiler/Klang/Value.class differ diff --git a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseListener.java b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseListener.java deleted file mode 100644 index 6d0bec9..0000000 --- a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseListener.java +++ /dev/null @@ -1,340 +0,0 @@ -// Generated from de/hsrm/compiler/Klang/Klang.g4 by ANTLR 4.5 -package de.hsrm.compiler.Klang; - -import org.antlr.v4.runtime.ParserRuleContext; -import org.antlr.v4.runtime.misc.NotNull; -import org.antlr.v4.runtime.tree.ErrorNode; -import org.antlr.v4.runtime.tree.TerminalNode; - -/** - * This class provides an empty implementation of {@link KlangListener}, - * which can be extended to create a listener which only needs to handle a subset - * of the available methods. - */ -public class KlangBaseListener implements KlangListener { - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterParse(KlangParser.ParseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitParse(KlangParser.ParseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBlock(KlangParser.BlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBlock(KlangParser.BlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStat(KlangParser.StatContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStat(KlangParser.StatContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssignment(KlangParser.AssignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssignment(KlangParser.AssignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIf_stat(KlangParser.If_statContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIf_stat(KlangParser.If_statContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCondition_block(KlangParser.Condition_blockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCondition_block(KlangParser.Condition_blockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStat_block(KlangParser.Stat_blockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStat_block(KlangParser.Stat_blockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterWhile_stat(KlangParser.While_statContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitWhile_stat(KlangParser.While_statContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLog(KlangParser.LogContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLog(KlangParser.LogContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNotExpr(KlangParser.NotExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNotExpr(KlangParser.NotExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnaryMinusExpr(KlangParser.UnaryMinusExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnaryMinusExpr(KlangParser.UnaryMinusExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMultiplicationExpr(KlangParser.MultiplicationExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMultiplicationExpr(KlangParser.MultiplicationExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAtomExpr(KlangParser.AtomExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAtomExpr(KlangParser.AtomExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterOrExpr(KlangParser.OrExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitOrExpr(KlangParser.OrExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAdditiveExpr(KlangParser.AdditiveExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAdditiveExpr(KlangParser.AdditiveExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPowExpr(KlangParser.PowExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPowExpr(KlangParser.PowExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRelationalExpr(KlangParser.RelationalExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRelationalExpr(KlangParser.RelationalExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEqualityExpr(KlangParser.EqualityExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEqualityExpr(KlangParser.EqualityExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAndExpr(KlangParser.AndExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAndExpr(KlangParser.AndExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterParExpr(KlangParser.ParExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitParExpr(KlangParser.ParExprContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNumberAtom(KlangParser.NumberAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNumberAtom(KlangParser.NumberAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBooleanAtom(KlangParser.BooleanAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBooleanAtom(KlangParser.BooleanAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIdAtom(KlangParser.IdAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIdAtom(KlangParser.IdAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStringAtom(KlangParser.StringAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStringAtom(KlangParser.StringAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNilAtom(KlangParser.NilAtomContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNilAtom(KlangParser.NilAtomContext ctx) { } - - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitTerminal(TerminalNode node) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitErrorNode(ErrorNode node) { } -} \ No newline at end of file diff --git a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseVisitor.java b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseVisitor.java new file mode 100644 index 0000000..955accb --- /dev/null +++ b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseVisitor.java @@ -0,0 +1,190 @@ +// Generated from de/hsrm/compiler/Klang/Klang.g4 by ANTLR 4.5 +package de.hsrm.compiler.Klang; +import org.antlr.v4.runtime.misc.NotNull; +import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; + +/** + * This class provides an empty implementation of {@link KlangVisitor}, + * which can be extended to create a visitor which only needs to handle a subset + * of the available methods. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public class KlangBaseVisitor extends AbstractParseTreeVisitor implements KlangVisitor { + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitParse(KlangParser.ParseContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitBlock(KlangParser.BlockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStat(KlangParser.StatContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAssignment(KlangParser.AssignmentContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIf_stat(KlangParser.If_statContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitCondition_block(KlangParser.Condition_blockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStat_block(KlangParser.Stat_blockContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitWhile_stat(KlangParser.While_statContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitLog(KlangParser.LogContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitNotExpr(KlangParser.NotExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitUnaryMinusExpr(KlangParser.UnaryMinusExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitMultiplicationExpr(KlangParser.MultiplicationExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAtomExpr(KlangParser.AtomExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitOrExpr(KlangParser.OrExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAdditiveExpr(KlangParser.AdditiveExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitPowExpr(KlangParser.PowExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitRelationalExpr(KlangParser.RelationalExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitEqualityExpr(KlangParser.EqualityExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAndExpr(KlangParser.AndExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitParExpr(KlangParser.ParExprContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitNumberAtom(KlangParser.NumberAtomContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitBooleanAtom(KlangParser.BooleanAtomContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitIdAtom(KlangParser.IdAtomContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitStringAtom(KlangParser.StringAtomContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitNilAtom(KlangParser.NilAtomContext ctx) { return visitChildren(ctx); } +} \ No newline at end of file diff --git a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangListener.java b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangListener.java deleted file mode 100644 index 9eafcbe..0000000 --- a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangListener.java +++ /dev/null @@ -1,293 +0,0 @@ -// Generated from de/hsrm/compiler/Klang/Klang.g4 by ANTLR 4.5 -package de.hsrm.compiler.Klang; -import org.antlr.v4.runtime.misc.NotNull; -import org.antlr.v4.runtime.tree.ParseTreeListener; - -/** - * This interface defines a complete listener for a parse tree produced by - * {@link KlangParser}. - */ -public interface KlangListener extends ParseTreeListener { - /** - * Enter a parse tree produced by {@link KlangParser#parse}. - * @param ctx the parse tree - */ - void enterParse(KlangParser.ParseContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#parse}. - * @param ctx the parse tree - */ - void exitParse(KlangParser.ParseContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#block}. - * @param ctx the parse tree - */ - void enterBlock(KlangParser.BlockContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#block}. - * @param ctx the parse tree - */ - void exitBlock(KlangParser.BlockContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#stat}. - * @param ctx the parse tree - */ - void enterStat(KlangParser.StatContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#stat}. - * @param ctx the parse tree - */ - void exitStat(KlangParser.StatContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#assignment}. - * @param ctx the parse tree - */ - void enterAssignment(KlangParser.AssignmentContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#assignment}. - * @param ctx the parse tree - */ - void exitAssignment(KlangParser.AssignmentContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#if_stat}. - * @param ctx the parse tree - */ - void enterIf_stat(KlangParser.If_statContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#if_stat}. - * @param ctx the parse tree - */ - void exitIf_stat(KlangParser.If_statContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#condition_block}. - * @param ctx the parse tree - */ - void enterCondition_block(KlangParser.Condition_blockContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#condition_block}. - * @param ctx the parse tree - */ - void exitCondition_block(KlangParser.Condition_blockContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#stat_block}. - * @param ctx the parse tree - */ - void enterStat_block(KlangParser.Stat_blockContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#stat_block}. - * @param ctx the parse tree - */ - void exitStat_block(KlangParser.Stat_blockContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#while_stat}. - * @param ctx the parse tree - */ - void enterWhile_stat(KlangParser.While_statContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#while_stat}. - * @param ctx the parse tree - */ - void exitWhile_stat(KlangParser.While_statContext ctx); - /** - * Enter a parse tree produced by {@link KlangParser#log}. - * @param ctx the parse tree - */ - void enterLog(KlangParser.LogContext ctx); - /** - * Exit a parse tree produced by {@link KlangParser#log}. - * @param ctx the parse tree - */ - void exitLog(KlangParser.LogContext ctx); - /** - * Enter a parse tree produced by the {@code notExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterNotExpr(KlangParser.NotExprContext ctx); - /** - * Exit a parse tree produced by the {@code notExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitNotExpr(KlangParser.NotExprContext ctx); - /** - * Enter a parse tree produced by the {@code unaryMinusExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterUnaryMinusExpr(KlangParser.UnaryMinusExprContext ctx); - /** - * Exit a parse tree produced by the {@code unaryMinusExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitUnaryMinusExpr(KlangParser.UnaryMinusExprContext ctx); - /** - * Enter a parse tree produced by the {@code multiplicationExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterMultiplicationExpr(KlangParser.MultiplicationExprContext ctx); - /** - * Exit a parse tree produced by the {@code multiplicationExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitMultiplicationExpr(KlangParser.MultiplicationExprContext ctx); - /** - * Enter a parse tree produced by the {@code atomExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterAtomExpr(KlangParser.AtomExprContext ctx); - /** - * Exit a parse tree produced by the {@code atomExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitAtomExpr(KlangParser.AtomExprContext ctx); - /** - * Enter a parse tree produced by the {@code orExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterOrExpr(KlangParser.OrExprContext ctx); - /** - * Exit a parse tree produced by the {@code orExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitOrExpr(KlangParser.OrExprContext ctx); - /** - * Enter a parse tree produced by the {@code additiveExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterAdditiveExpr(KlangParser.AdditiveExprContext ctx); - /** - * Exit a parse tree produced by the {@code additiveExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitAdditiveExpr(KlangParser.AdditiveExprContext ctx); - /** - * Enter a parse tree produced by the {@code powExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterPowExpr(KlangParser.PowExprContext ctx); - /** - * Exit a parse tree produced by the {@code powExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitPowExpr(KlangParser.PowExprContext ctx); - /** - * Enter a parse tree produced by the {@code relationalExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterRelationalExpr(KlangParser.RelationalExprContext ctx); - /** - * Exit a parse tree produced by the {@code relationalExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitRelationalExpr(KlangParser.RelationalExprContext ctx); - /** - * Enter a parse tree produced by the {@code equalityExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterEqualityExpr(KlangParser.EqualityExprContext ctx); - /** - * Exit a parse tree produced by the {@code equalityExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitEqualityExpr(KlangParser.EqualityExprContext ctx); - /** - * Enter a parse tree produced by the {@code andExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void enterAndExpr(KlangParser.AndExprContext ctx); - /** - * Exit a parse tree produced by the {@code andExpr} - * labeled alternative in {@link KlangParser#expr}. - * @param ctx the parse tree - */ - void exitAndExpr(KlangParser.AndExprContext ctx); - /** - * Enter a parse tree produced by the {@code parExpr} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void enterParExpr(KlangParser.ParExprContext ctx); - /** - * Exit a parse tree produced by the {@code parExpr} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void exitParExpr(KlangParser.ParExprContext ctx); - /** - * Enter a parse tree produced by the {@code numberAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void enterNumberAtom(KlangParser.NumberAtomContext ctx); - /** - * Exit a parse tree produced by the {@code numberAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void exitNumberAtom(KlangParser.NumberAtomContext ctx); - /** - * Enter a parse tree produced by the {@code booleanAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void enterBooleanAtom(KlangParser.BooleanAtomContext ctx); - /** - * Exit a parse tree produced by the {@code booleanAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void exitBooleanAtom(KlangParser.BooleanAtomContext ctx); - /** - * Enter a parse tree produced by the {@code idAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void enterIdAtom(KlangParser.IdAtomContext ctx); - /** - * Exit a parse tree produced by the {@code idAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void exitIdAtom(KlangParser.IdAtomContext ctx); - /** - * Enter a parse tree produced by the {@code stringAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void enterStringAtom(KlangParser.StringAtomContext ctx); - /** - * Exit a parse tree produced by the {@code stringAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void exitStringAtom(KlangParser.StringAtomContext ctx); - /** - * Enter a parse tree produced by the {@code nilAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void enterNilAtom(KlangParser.NilAtomContext ctx); - /** - * Exit a parse tree produced by the {@code nilAtom} - * labeled alternative in {@link KlangParser#atom}. - * @param ctx the parse tree - */ - void exitNilAtom(KlangParser.NilAtomContext ctx); -} \ No newline at end of file diff --git a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangParser.java b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangParser.java index 59fa897..3ee43ca 100644 --- a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangParser.java +++ b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangParser.java @@ -102,12 +102,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_parse; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterParse(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitParse(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitParse(this); + else return visitor.visitChildren(this); } } @@ -146,12 +143,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_block; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterBlock(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitBlock(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitBlock(this); + else return visitor.visitChildren(this); } } @@ -209,12 +203,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_stat; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterStat(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitStat(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitStat(this); + else return visitor.visitChildren(this); } } @@ -287,12 +278,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_assignment; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterAssignment(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitAssignment(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitAssignment(this); + else return visitor.visitChildren(this); } } @@ -346,12 +334,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_if_stat; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterIf_stat(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitIf_stat(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitIf_stat(this); + else return visitor.visitChildren(this); } } @@ -422,12 +407,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_condition_block; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterCondition_block(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitCondition_block(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitCondition_block(this); + else return visitor.visitChildren(this); } } @@ -468,12 +450,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_stat_block; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterStat_block(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitStat_block(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitStat_block(this); + else return visitor.visitChildren(this); } } @@ -533,12 +512,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_while_stat; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterWhile_stat(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitWhile_stat(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitWhile_stat(this); + else return visitor.visitChildren(this); } } @@ -578,12 +554,9 @@ public class KlangParser extends Parser { } @Override public int getRuleIndex() { return RULE_log; } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterLog(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitLog(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitLog(this); + else return visitor.visitChildren(this); } } @@ -630,12 +603,9 @@ public class KlangParser extends Parser { } public NotExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterNotExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitNotExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitNotExpr(this); + else return visitor.visitChildren(this); } } public static class UnaryMinusExprContext extends ExprContext { @@ -645,12 +615,9 @@ public class KlangParser extends Parser { } public UnaryMinusExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterUnaryMinusExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitUnaryMinusExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitUnaryMinusExpr(this); + else return visitor.visitChildren(this); } } public static class MultiplicationExprContext extends ExprContext { @@ -666,12 +633,9 @@ public class KlangParser extends Parser { public TerminalNode MOD() { return getToken(KlangParser.MOD, 0); } public MultiplicationExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterMultiplicationExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitMultiplicationExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitMultiplicationExpr(this); + else return visitor.visitChildren(this); } } public static class AtomExprContext extends ExprContext { @@ -680,12 +644,9 @@ public class KlangParser extends Parser { } public AtomExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterAtomExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitAtomExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitAtomExpr(this); + else return visitor.visitChildren(this); } } public static class OrExprContext extends ExprContext { @@ -698,12 +659,9 @@ public class KlangParser extends Parser { public TerminalNode OR() { return getToken(KlangParser.OR, 0); } public OrExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterOrExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitOrExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitOrExpr(this); + else return visitor.visitChildren(this); } } public static class AdditiveExprContext extends ExprContext { @@ -718,12 +676,9 @@ public class KlangParser extends Parser { public TerminalNode MINUS() { return getToken(KlangParser.MINUS, 0); } public AdditiveExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterAdditiveExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitAdditiveExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitAdditiveExpr(this); + else return visitor.visitChildren(this); } } public static class PowExprContext extends ExprContext { @@ -736,12 +691,9 @@ public class KlangParser extends Parser { public TerminalNode POW() { return getToken(KlangParser.POW, 0); } public PowExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterPowExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitPowExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitPowExpr(this); + else return visitor.visitChildren(this); } } public static class RelationalExprContext extends ExprContext { @@ -758,12 +710,9 @@ public class KlangParser extends Parser { public TerminalNode GT() { return getToken(KlangParser.GT, 0); } public RelationalExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterRelationalExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitRelationalExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitRelationalExpr(this); + else return visitor.visitChildren(this); } } public static class EqualityExprContext extends ExprContext { @@ -778,12 +727,9 @@ public class KlangParser extends Parser { public TerminalNode NEQ() { return getToken(KlangParser.NEQ, 0); } public EqualityExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterEqualityExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitEqualityExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitEqualityExpr(this); + else return visitor.visitChildren(this); } } public static class AndExprContext extends ExprContext { @@ -796,12 +742,9 @@ public class KlangParser extends Parser { public TerminalNode AND() { return getToken(KlangParser.AND, 0); } public AndExprContext(ExprContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterAndExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitAndExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitAndExpr(this); + else return visitor.visitChildren(this); } } @@ -1023,12 +966,9 @@ public class KlangParser extends Parser { public TerminalNode CPAR() { return getToken(KlangParser.CPAR, 0); } public ParExprContext(AtomContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterParExpr(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitParExpr(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitParExpr(this); + else return visitor.visitChildren(this); } } public static class BooleanAtomContext extends AtomContext { @@ -1036,48 +976,36 @@ public class KlangParser extends Parser { public TerminalNode FALSE() { return getToken(KlangParser.FALSE, 0); } public BooleanAtomContext(AtomContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterBooleanAtom(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitBooleanAtom(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitBooleanAtom(this); + else return visitor.visitChildren(this); } } public static class IdAtomContext extends AtomContext { public TerminalNode ID() { return getToken(KlangParser.ID, 0); } public IdAtomContext(AtomContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterIdAtom(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitIdAtom(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitIdAtom(this); + else return visitor.visitChildren(this); } } public static class StringAtomContext extends AtomContext { public TerminalNode STRING() { return getToken(KlangParser.STRING, 0); } public StringAtomContext(AtomContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterStringAtom(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitStringAtom(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitStringAtom(this); + else return visitor.visitChildren(this); } } public static class NilAtomContext extends AtomContext { public TerminalNode NIL() { return getToken(KlangParser.NIL, 0); } public NilAtomContext(AtomContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterNilAtom(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitNilAtom(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitNilAtom(this); + else return visitor.visitChildren(this); } } public static class NumberAtomContext extends AtomContext { @@ -1085,12 +1013,9 @@ public class KlangParser extends Parser { public TerminalNode FLOAT() { return getToken(KlangParser.FLOAT, 0); } public NumberAtomContext(AtomContext ctx) { copyFrom(ctx); } @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).enterNumberAtom(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof KlangListener ) ((KlangListener)listener).exitNumberAtom(this); + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof KlangVisitor ) return ((KlangVisitor)visitor).visitNumberAtom(this); + else return visitor.visitChildren(this); } } diff --git a/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangVisitor.java b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangVisitor.java new file mode 100644 index 0000000..3ce2539 --- /dev/null +++ b/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangVisitor.java @@ -0,0 +1,180 @@ +// Generated from de/hsrm/compiler/Klang/Klang.g4 by ANTLR 4.5 +package de.hsrm.compiler.Klang; +import org.antlr.v4.runtime.misc.NotNull; +import org.antlr.v4.runtime.tree.ParseTreeVisitor; + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by {@link KlangParser}. + * + * @param The return type of the visit operation. Use {@link Void} for + * operations with no return type. + */ +public interface KlangVisitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by {@link KlangParser#parse}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitParse(KlangParser.ParseContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitBlock(KlangParser.BlockContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#stat}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStat(KlangParser.StatContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#assignment}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAssignment(KlangParser.AssignmentContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#if_stat}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIf_stat(KlangParser.If_statContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#condition_block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitCondition_block(KlangParser.Condition_blockContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#stat_block}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStat_block(KlangParser.Stat_blockContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#while_stat}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitWhile_stat(KlangParser.While_statContext ctx); + /** + * Visit a parse tree produced by {@link KlangParser#log}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitLog(KlangParser.LogContext ctx); + /** + * Visit a parse tree produced by the {@code notExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNotExpr(KlangParser.NotExprContext ctx); + /** + * Visit a parse tree produced by the {@code unaryMinusExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitUnaryMinusExpr(KlangParser.UnaryMinusExprContext ctx); + /** + * Visit a parse tree produced by the {@code multiplicationExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitMultiplicationExpr(KlangParser.MultiplicationExprContext ctx); + /** + * Visit a parse tree produced by the {@code atomExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAtomExpr(KlangParser.AtomExprContext ctx); + /** + * Visit a parse tree produced by the {@code orExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitOrExpr(KlangParser.OrExprContext ctx); + /** + * Visit a parse tree produced by the {@code additiveExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAdditiveExpr(KlangParser.AdditiveExprContext ctx); + /** + * Visit a parse tree produced by the {@code powExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitPowExpr(KlangParser.PowExprContext ctx); + /** + * Visit a parse tree produced by the {@code relationalExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitRelationalExpr(KlangParser.RelationalExprContext ctx); + /** + * Visit a parse tree produced by the {@code equalityExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitEqualityExpr(KlangParser.EqualityExprContext ctx); + /** + * Visit a parse tree produced by the {@code andExpr} + * labeled alternative in {@link KlangParser#expr}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAndExpr(KlangParser.AndExprContext ctx); + /** + * Visit a parse tree produced by the {@code parExpr} + * labeled alternative in {@link KlangParser#atom}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitParExpr(KlangParser.ParExprContext ctx); + /** + * Visit a parse tree produced by the {@code numberAtom} + * labeled alternative in {@link KlangParser#atom}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNumberAtom(KlangParser.NumberAtomContext ctx); + /** + * Visit a parse tree produced by the {@code booleanAtom} + * labeled alternative in {@link KlangParser#atom}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitBooleanAtom(KlangParser.BooleanAtomContext ctx); + /** + * Visit a parse tree produced by the {@code idAtom} + * labeled alternative in {@link KlangParser#atom}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitIdAtom(KlangParser.IdAtomContext ctx); + /** + * Visit a parse tree produced by the {@code stringAtom} + * labeled alternative in {@link KlangParser#atom}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitStringAtom(KlangParser.StringAtomContext ctx); + /** + * Visit a parse tree produced by the {@code nilAtom} + * labeled alternative in {@link KlangParser#atom}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitNilAtom(KlangParser.NilAtomContext ctx); +} \ No newline at end of file diff --git a/target/klang-1.0-jar-with-dependencies.jar b/target/klang-1.0-jar-with-dependencies.jar index b45f168..82685b8 100644 Binary files a/target/klang-1.0-jar-with-dependencies.jar and b/target/klang-1.0-jar-with-dependencies.jar differ diff --git a/target/klang-1.0.jar b/target/klang-1.0.jar index c829dd1..d6d3434 100644 Binary files a/target/klang-1.0.jar and b/target/klang-1.0.jar differ diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index a5ea0b6..2251886 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,5 +1,5 @@ -/home/marvin/Documents/university/compiler/antlr_test/klang/klang/src/main/java/de/hsrm/compiler/Klang/Klang.java -/home/marvin/Documents/university/compiler/antlr_test/klang/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangParser.java -/home/marvin/Documents/university/compiler/antlr_test/klang/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseListener.java -/home/marvin/Documents/university/compiler/antlr_test/klang/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangLexer.java -/home/marvin/Documents/university/compiler/antlr_test/klang/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangListener.java +/home/marvin/Documents/university/compiler/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangLexer.java +/home/marvin/Documents/university/compiler/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangBaseVisitor.java +/home/marvin/Documents/university/compiler/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangParser.java +/home/marvin/Documents/university/compiler/klang/src/main/java/de/hsrm/compiler/Klang/Klang.java +/home/marvin/Documents/university/compiler/klang/target/generated-sources/antlr4/de/hsrm/compiler/Klang/KlangVisitor.java