Added this and null to expressions

This commit is contained in:
laurenz 2024-05-15 17:29:25 +02:00
parent 8318defd30
commit ab6c71e9d1
12 changed files with 211 additions and 124 deletions

View File

@ -38,6 +38,7 @@ expr : expr binaryOp expr #BinaryOperation
| '(' expr ')' #Expression
| fieldVarAccess #Identifier
| stmtexpr #StatementExpressionexpr
| THIS #This
| NULL #Null
;

View File

@ -121,6 +121,16 @@ public class ExpressionGenerator extends DecafBaseVisitor<Expression> {
return new New(type, args);
}
@Override
public Expression visitNull(DecafParser.NullContext ctx){
return new Null();
}
@Override
public Expression visitThis(DecafParser.ThisContext ctx){
return new This();
}
public static Expression generateRecursiveOwnerChain(List<DecafParser.RecipientContext> ctxList, FieldVarAccess recipient) {
if (ctxList.isEmpty()) {
return recipient;

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
// Generated from C:/dev/Pressmium/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
// Generated from C:/Users/laure/Documents/Dev/Compilerbau/Projekt/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.ParserRuleContext;
@ -360,6 +360,18 @@ public class DecafBaseListener implements DecafListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBinaryOperation(DecafParser.BinaryOperationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterThis(DecafParser.ThisContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitThis(DecafParser.ThisContext ctx) { }
/**
* {@inheritDoc}
*

View File

@ -1,4 +1,4 @@
// Generated from C:/dev/Pressmium/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
// Generated from C:/Users/laure/Documents/Dev/Compilerbau/Projekt/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
@ -215,6 +215,13 @@ public class DecafBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBinaryOperation(DecafParser.BinaryOperationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitThis(DecafParser.ThisContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*

View File

@ -1,4 +1,4 @@
// Generated from C:/dev/Pressmium/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
// Generated from C:/Users/laure/Documents/Dev/Compilerbau/Projekt/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;

View File

@ -1,4 +1,4 @@
// Generated from C:/dev/Pressmium/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
// Generated from C:/Users/laure/Documents/Dev/Compilerbau/Projekt/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.tree.ParseTreeListener;
@ -331,6 +331,18 @@ public interface DecafListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitBinaryOperation(DecafParser.BinaryOperationContext ctx);
/**
* Enter a parse tree produced by the {@code This}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void enterThis(DecafParser.ThisContext ctx);
/**
* Exit a parse tree produced by the {@code This}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
*/
void exitThis(DecafParser.ThisContext ctx);
/**
* Enter a parse tree produced by the {@code StatementExpressionexpr}
* labeled alternative in {@link DecafParser#expr}.

View File

@ -1,4 +1,4 @@
// Generated from C:/dev/Pressmium/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
// Generated from C:/Users/laure/Documents/Dev/Compilerbau/Projekt/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
@ -1580,6 +1580,24 @@ public class DecafParser extends Parser {
}
}
@SuppressWarnings("CheckReturnValue")
public static class ThisContext extends ExprContext {
public TerminalNode THIS() { return getToken(DecafParser.THIS, 0); }
public ThisContext(ExprContext ctx) { copyFrom(ctx); }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof DecafListener ) ((DecafListener)listener).enterThis(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof DecafListener ) ((DecafListener)listener).exitThis(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof DecafVisitor ) return ((DecafVisitor<? extends T>)visitor).visitThis(this);
else return visitor.visitChildren(this);
}
}
@SuppressWarnings("CheckReturnValue")
public static class StatementExpressionexprContext extends ExprContext {
public StmtexprContext stmtexpr() {
return getRuleContext(StmtexprContext.class,0);
@ -1615,7 +1633,7 @@ public class DecafParser extends Parser {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(212);
setState(213);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) {
case 1:
@ -1627,7 +1645,7 @@ public class DecafParser extends Parser {
setState(201);
unaryOp();
setState(202);
expr(6);
expr(7);
}
break;
case 2:
@ -1672,16 +1690,25 @@ public class DecafParser extends Parser {
break;
case 6:
{
_localctx = new NullContext(_localctx);
_localctx = new ThisContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(211);
match(THIS);
}
break;
case 7:
{
_localctx = new NullContext(_localctx);
_ctx = _localctx;
_prevctx = _localctx;
setState(212);
match(NULL);
}
break;
}
_ctx.stop = _input.LT(-1);
setState(220);
setState(221);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,17,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
@ -1692,16 +1719,16 @@ public class DecafParser extends Parser {
{
_localctx = new BinaryOperationContext(new ExprContext(_parentctx, _parentState));
pushNewRecursionContext(_localctx, _startState, RULE_expr);
setState(214);
if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
setState(215);
binaryOp();
if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
setState(216);
expr(8);
binaryOp();
setState(217);
expr(9);
}
}
}
setState(222);
setState(223);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,17,_ctx);
}
@ -1757,7 +1784,7 @@ public class DecafParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(223);
setState(224);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 17171480576L) != 0)) ) {
_errHandler.recoverInline(this);
@ -1810,7 +1837,7 @@ public class DecafParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(225);
setState(226);
_la = _input.LA(1);
if ( !(_la==SUB || _la==NOT) ) {
_errHandler.recoverInline(this);
@ -1872,37 +1899,37 @@ public class DecafParser extends Parser {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(229);
setState(230);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==THIS) {
{
setState(227);
match(THIS);
setState(228);
match(THIS);
setState(229);
match(T__17);
}
}
setState(236);
setState(237);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,19,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
setState(231);
recipient();
setState(232);
recipient();
setState(233);
match(T__17);
}
}
}
setState(238);
setState(239);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,19,_ctx);
}
setState(239);
setState(240);
id();
}
}
@ -1953,11 +1980,11 @@ public class DecafParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(241);
fieldVarAccess();
setState(242);
assignSign();
fieldVarAccess();
setState(243);
assignSign();
setState(244);
expr(0);
}
}
@ -2011,37 +2038,37 @@ public class DecafParser extends Parser {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(247);
setState(248);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==THIS) {
{
setState(245);
match(THIS);
setState(246);
match(THIS);
setState(247);
match(T__17);
}
}
setState(254);
setState(255);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,21,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
{
{
setState(249);
recipient();
setState(250);
recipient();
setState(251);
match(T__17);
}
}
}
setState(256);
setState(257);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,21,_ctx);
}
setState(257);
setState(258);
methName();
}
}
@ -2087,20 +2114,20 @@ public class DecafParser extends Parser {
RecipientContext _localctx = new RecipientContext(_ctx, getState());
enterRule(_localctx, 40, RULE_recipient);
try {
setState(261);
setState(262);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) {
case 1:
enterOuterAlt(_localctx, 1);
{
setState(259);
setState(260);
methName();
}
break;
case 2:
enterOuterAlt(_localctx, 2);
{
setState(260);
setState(261);
id();
}
break;
@ -2151,21 +2178,21 @@ public class DecafParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(263);
id();
setState(264);
id();
setState(265);
match(T__4);
setState(266);
setState(267);
_errHandler.sync(this);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 132216288968736L) != 0)) {
{
setState(265);
setState(266);
args();
}
}
setState(268);
setState(269);
match(T__5);
}
}
@ -2214,21 +2241,21 @@ public class DecafParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(270);
setState(271);
expr(0);
setState(275);
setState(276);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__9) {
{
{
setState(271);
match(T__9);
setState(272);
match(T__9);
setState(273);
expr(0);
}
}
setState(277);
setState(278);
_errHandler.sync(this);
_la = _input.LA(1);
}
@ -2276,7 +2303,7 @@ public class DecafParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(278);
setState(279);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 96757023244288L) != 0)) ) {
_errHandler.recoverInline(this);
@ -2327,7 +2354,7 @@ public class DecafParser extends Parser {
try {
enterOuterAlt(_localctx, 1);
{
setState(280);
setState(281);
match(IDENTIFIER);
}
}
@ -2352,13 +2379,13 @@ public class DecafParser extends Parser {
private boolean expr_sempred(ExprContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 7);
return precpred(_ctx, 8);
}
return true;
}
public static final String _serializedATN =
"\u0004\u00011\u011b\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
"\u0004\u00011\u011c\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+
"\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+
"\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002"+
"\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002"+
@ -2388,32 +2415,32 @@ public class DecafParser extends Parser {
"\r\u0001\r\u0001\r\u0003\r\u00c3\b\r\u0001\r\u0001\r\u0003\r\u00c7\b\r"+
"\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+
"\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+
"\u0003\u000e\u00d5\b\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+
"\u0005\u000e\u00db\b\u000e\n\u000e\f\u000e\u00de\t\u000e\u0001\u000f\u0001"+
"\u000f\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0003\u0011\u00e6"+
"\b\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0005\u0011\u00eb\b\u0011"+
"\n\u0011\f\u0011\u00ee\t\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+
"\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0003\u0013\u00f8"+
"\b\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0005\u0013\u00fd\b\u0013"+
"\n\u0013\f\u0013\u0100\t\u0013\u0001\u0013\u0001\u0013\u0001\u0014\u0001"+
"\u0014\u0003\u0014\u0106\b\u0014\u0001\u0015\u0001\u0015\u0001\u0015\u0003"+
"\u0015\u010b\b\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016\u0001"+
"\u0016\u0005\u0016\u0112\b\u0016\n\u0016\f\u0016\u0115\t\u0016\u0001\u0017"+
"\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0018\u0000\u0001\u001c\u0019"+
"\u0000\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014\u0016\u0018\u001a"+
"\u001c\u001e \"$&(*,.0\u0000\u0004\u0001\u0000\"%\u0001\u0000\u0017!\u0002"+
"\u0000\u0017\u0017&&\u0002\u0000+,..\u0128\u00002\u0001\u0000\u0000\u0000"+
"\u0002D\u0001\u0000\u0000\u0000\u0004J\u0001\u0000\u0000\u0000\u0006N"+
"\u0001\u0000\u0000\u0000\bR\u0001\u0000\u0000\u0000\nX\u0001\u0000\u0000"+
"\u0001\u000e\u0003\u000e\u00d6\b\u000e\u0001\u000e\u0001\u000e\u0001\u000e"+
"\u0001\u000e\u0005\u000e\u00dc\b\u000e\n\u000e\f\u000e\u00df\t\u000e\u0001"+
"\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0003"+
"\u0011\u00e7\b\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0005\u0011\u00ec"+
"\b\u0011\n\u0011\f\u0011\u00ef\t\u0011\u0001\u0011\u0001\u0011\u0001\u0012"+
"\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0003\u0013"+
"\u00f9\b\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0005\u0013\u00fe\b"+
"\u0013\n\u0013\f\u0013\u0101\t\u0013\u0001\u0013\u0001\u0013\u0001\u0014"+
"\u0001\u0014\u0003\u0014\u0107\b\u0014\u0001\u0015\u0001\u0015\u0001\u0015"+
"\u0003\u0015\u010c\b\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0001\u0016"+
"\u0001\u0016\u0005\u0016\u0113\b\u0016\n\u0016\f\u0016\u0116\t\u0016\u0001"+
"\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0018\u0000\u0001\u001c"+
"\u0019\u0000\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014\u0016\u0018"+
"\u001a\u001c\u001e \"$&(*,.0\u0000\u0004\u0001\u0000\"%\u0001\u0000\u0017"+
"!\u0002\u0000\u0017\u0017&&\u0002\u0000+,..\u012a\u00002\u0001\u0000\u0000"+
"\u0000\u0002D\u0001\u0000\u0000\u0000\u0004J\u0001\u0000\u0000\u0000\u0006"+
"N\u0001\u0000\u0000\u0000\bR\u0001\u0000\u0000\u0000\nX\u0001\u0000\u0000"+
"\u0000\fZ\u0001\u0000\u0000\u0000\u000ed\u0001\u0000\u0000\u0000\u0010"+
"m\u0001\u0000\u0000\u0000\u0012v\u0001\u0000\u0000\u0000\u0014~\u0001"+
"\u0000\u0000\u0000\u0016\u0081\u0001\u0000\u0000\u0000\u0018\u00bb\u0001"+
"\u0000\u0000\u0000\u001a\u00c6\u0001\u0000\u0000\u0000\u001c\u00d4\u0001"+
"\u0000\u0000\u0000\u001e\u00df\u0001\u0000\u0000\u0000 \u00e1\u0001\u0000"+
"\u0000\u0000\"\u00e5\u0001\u0000\u0000\u0000$\u00f1\u0001\u0000\u0000"+
"\u0000&\u00f7\u0001\u0000\u0000\u0000(\u0105\u0001\u0000\u0000\u0000*"+
"\u0107\u0001\u0000\u0000\u0000,\u010e\u0001\u0000\u0000\u0000.\u0116\u0001"+
"\u0000\u0000\u00000\u0118\u0001\u0000\u0000\u000023\u0005\u0013\u0000"+
"\u0000\u0000\u0000\u001a\u00c6\u0001\u0000\u0000\u0000\u001c\u00d5\u0001"+
"\u0000\u0000\u0000\u001e\u00e0\u0001\u0000\u0000\u0000 \u00e2\u0001\u0000"+
"\u0000\u0000\"\u00e6\u0001\u0000\u0000\u0000$\u00f2\u0001\u0000\u0000"+
"\u0000&\u00f8\u0001\u0000\u0000\u0000(\u0106\u0001\u0000\u0000\u0000*"+
"\u0108\u0001\u0000\u0000\u0000,\u010f\u0001\u0000\u0000\u0000.\u0117\u0001"+
"\u0000\u0000\u00000\u0119\u0001\u0000\u0000\u000023\u0005\u0013\u0000"+
"\u000034\u0005\u0001\u0000\u000045\u00030\u0018\u000057\u0005\u0002\u0000"+
"\u000068\u0003\u000e\u0007\u000076\u0001\u0000\u0000\u000078\u0001\u0000"+
"\u0000\u00008>\u0001\u0000\u0000\u00009=\u0003\u0002\u0001\u0000:=\u0003"+
@ -2489,53 +2516,54 @@ public class DecafParser extends Parser {
"\u0000\u00c5\u00c7\u0001\u0000\u0000\u0000\u00c6\u00bd\u0001\u0000\u0000"+
"\u0000\u00c6\u00be\u0001\u0000\u0000\u0000\u00c7\u001b\u0001\u0000\u0000"+
"\u0000\u00c8\u00c9\u0006\u000e\uffff\uffff\u0000\u00c9\u00ca\u0003 \u0010"+
"\u0000\u00ca\u00cb\u0003\u001c\u000e\u0006\u00cb\u00d5\u0001\u0000\u0000"+
"\u0000\u00cc\u00d5\u0003.\u0017\u0000\u00cd\u00ce\u0005\u0005\u0000\u0000"+
"\u0000\u00ca\u00cb\u0003\u001c\u000e\u0007\u00cb\u00d6\u0001\u0000\u0000"+
"\u0000\u00cc\u00d6\u0003.\u0017\u0000\u00cd\u00ce\u0005\u0005\u0000\u0000"+
"\u00ce\u00cf\u0003\u001c\u000e\u0000\u00cf\u00d0\u0005\u0006\u0000\u0000"+
"\u00d0\u00d5\u0001\u0000\u0000\u0000\u00d1\u00d5\u0003\"\u0011\u0000\u00d2"+
"\u00d5\u0003\u001a\r\u0000\u00d3\u00d5\u0005\u0015\u0000\u0000\u00d4\u00c8"+
"\u0001\u0000\u0000\u0000\u00d4\u00cc\u0001\u0000\u0000\u0000\u00d4\u00cd"+
"\u0001\u0000\u0000\u0000\u00d4\u00d1\u0001\u0000\u0000\u0000\u00d4\u00d2"+
"\u0001\u0000\u0000\u0000\u00d4\u00d3\u0001\u0000\u0000\u0000\u00d5\u00dc"+
"\u0001\u0000\u0000\u0000\u00d6\u00d7\n\u0007\u0000\u0000\u00d7\u00d8\u0003"+
"\u001e\u000f\u0000\u00d8\u00d9\u0003\u001c\u000e\b\u00d9\u00db\u0001\u0000"+
"\u0000\u0000\u00da\u00d6\u0001\u0000\u0000\u0000\u00db\u00de\u0001\u0000"+
"\u0000\u0000\u00dc\u00da\u0001\u0000\u0000\u0000\u00dc\u00dd\u0001\u0000"+
"\u0000\u0000\u00dd\u001d\u0001\u0000\u0000\u0000\u00de\u00dc\u0001\u0000"+
"\u0000\u0000\u00df\u00e0\u0007\u0001\u0000\u0000\u00e0\u001f\u0001\u0000"+
"\u0000\u0000\u00e1\u00e2\u0007\u0002\u0000\u0000\u00e2!\u0001\u0000\u0000"+
"\u0000\u00e3\u00e4\u0005\u0016\u0000\u0000\u00e4\u00e6\u0005\u0012\u0000"+
"\u0000\u00e5\u00e3\u0001\u0000\u0000\u0000\u00e5\u00e6\u0001\u0000\u0000"+
"\u0000\u00e6\u00ec\u0001\u0000\u0000\u0000\u00e7\u00e8\u0003(\u0014\u0000"+
"\u00e8\u00e9\u0005\u0012\u0000\u0000\u00e9\u00eb\u0001\u0000\u0000\u0000"+
"\u00ea\u00e7\u0001\u0000\u0000\u0000\u00eb\u00ee\u0001\u0000\u0000\u0000"+
"\u00ec\u00ea\u0001\u0000\u0000\u0000\u00ec\u00ed\u0001\u0000\u0000\u0000"+
"\u00ed\u00ef\u0001\u0000\u0000\u0000\u00ee\u00ec\u0001\u0000\u0000\u0000"+
"\u00ef\u00f0\u00030\u0018\u0000\u00f0#\u0001\u0000\u0000\u0000\u00f1\u00f2"+
"\u0003\"\u0011\u0000\u00f2\u00f3\u0003\u0006\u0003\u0000\u00f3\u00f4\u0003"+
"\u001c\u000e\u0000\u00f4%\u0001\u0000\u0000\u0000\u00f5\u00f6\u0005\u0016"+
"\u0000\u0000\u00f6\u00f8\u0005\u0012\u0000\u0000\u00f7\u00f5\u0001\u0000"+
"\u0000\u0000\u00f7\u00f8\u0001\u0000\u0000\u0000\u00f8\u00fe\u0001\u0000"+
"\u0000\u0000\u00f9\u00fa\u0003(\u0014\u0000\u00fa\u00fb\u0005\u0012\u0000"+
"\u0000\u00fb\u00fd\u0001\u0000\u0000\u0000\u00fc\u00f9\u0001\u0000\u0000"+
"\u0000\u00fd\u0100\u0001\u0000\u0000\u0000\u00fe\u00fc\u0001\u0000\u0000"+
"\u0000\u00fe\u00ff\u0001\u0000\u0000\u0000\u00ff\u0101\u0001\u0000\u0000"+
"\u0000\u0100\u00fe\u0001\u0000\u0000\u0000\u0101\u0102\u0003*\u0015\u0000"+
"\u0102\'\u0001\u0000\u0000\u0000\u0103\u0106\u0003*\u0015\u0000\u0104"+
"\u0106\u00030\u0018\u0000\u0105\u0103\u0001\u0000\u0000\u0000\u0105\u0104"+
"\u0001\u0000\u0000\u0000\u0106)\u0001\u0000\u0000\u0000\u0107\u0108\u0003"+
"0\u0018\u0000\u0108\u010a\u0005\u0005\u0000\u0000\u0109\u010b\u0003,\u0016"+
"\u0000\u010a\u0109\u0001\u0000\u0000\u0000\u010a\u010b\u0001\u0000\u0000"+
"\u0000\u010b\u010c\u0001\u0000\u0000\u0000\u010c\u010d\u0005\u0006\u0000"+
"\u0000\u010d+\u0001\u0000\u0000\u0000\u010e\u0113\u0003\u001c\u000e\u0000"+
"\u010f\u0110\u0005\n\u0000\u0000\u0110\u0112\u0003\u001c\u000e\u0000\u0111"+
"\u010f\u0001\u0000\u0000\u0000\u0112\u0115\u0001\u0000\u0000\u0000\u0113"+
"\u0111\u0001\u0000\u0000\u0000\u0113\u0114\u0001\u0000\u0000\u0000\u0114"+
"-\u0001\u0000\u0000\u0000\u0115\u0113\u0001\u0000\u0000\u0000\u0116\u0117"+
"\u0007\u0003\u0000\u0000\u0117/\u0001\u0000\u0000\u0000\u0118\u0119\u0005"+
"-\u0000\u0000\u01191\u0001\u0000\u0000\u0000\u00197<>DRX_q{\u0084\u0086"+
"\u0092\u00ab\u00bb\u00c2\u00c6\u00d4\u00dc\u00e5\u00ec\u00f7\u00fe\u0105"+
"\u010a\u0113";
"\u00d0\u00d6\u0001\u0000\u0000\u0000\u00d1\u00d6\u0003\"\u0011\u0000\u00d2"+
"\u00d6\u0003\u001a\r\u0000\u00d3\u00d6\u0005\u0016\u0000\u0000\u00d4\u00d6"+
"\u0005\u0015\u0000\u0000\u00d5\u00c8\u0001\u0000\u0000\u0000\u00d5\u00cc"+
"\u0001\u0000\u0000\u0000\u00d5\u00cd\u0001\u0000\u0000\u0000\u00d5\u00d1"+
"\u0001\u0000\u0000\u0000\u00d5\u00d2\u0001\u0000\u0000\u0000\u00d5\u00d3"+
"\u0001\u0000\u0000\u0000\u00d5\u00d4\u0001\u0000\u0000\u0000\u00d6\u00dd"+
"\u0001\u0000\u0000\u0000\u00d7\u00d8\n\b\u0000\u0000\u00d8\u00d9\u0003"+
"\u001e\u000f\u0000\u00d9\u00da\u0003\u001c\u000e\t\u00da\u00dc\u0001\u0000"+
"\u0000\u0000\u00db\u00d7\u0001\u0000\u0000\u0000\u00dc\u00df\u0001\u0000"+
"\u0000\u0000\u00dd\u00db\u0001\u0000\u0000\u0000\u00dd\u00de\u0001\u0000"+
"\u0000\u0000\u00de\u001d\u0001\u0000\u0000\u0000\u00df\u00dd\u0001\u0000"+
"\u0000\u0000\u00e0\u00e1\u0007\u0001\u0000\u0000\u00e1\u001f\u0001\u0000"+
"\u0000\u0000\u00e2\u00e3\u0007\u0002\u0000\u0000\u00e3!\u0001\u0000\u0000"+
"\u0000\u00e4\u00e5\u0005\u0016\u0000\u0000\u00e5\u00e7\u0005\u0012\u0000"+
"\u0000\u00e6\u00e4\u0001\u0000\u0000\u0000\u00e6\u00e7\u0001\u0000\u0000"+
"\u0000\u00e7\u00ed\u0001\u0000\u0000\u0000\u00e8\u00e9\u0003(\u0014\u0000"+
"\u00e9\u00ea\u0005\u0012\u0000\u0000\u00ea\u00ec\u0001\u0000\u0000\u0000"+
"\u00eb\u00e8\u0001\u0000\u0000\u0000\u00ec\u00ef\u0001\u0000\u0000\u0000"+
"\u00ed\u00eb\u0001\u0000\u0000\u0000\u00ed\u00ee\u0001\u0000\u0000\u0000"+
"\u00ee\u00f0\u0001\u0000\u0000\u0000\u00ef\u00ed\u0001\u0000\u0000\u0000"+
"\u00f0\u00f1\u00030\u0018\u0000\u00f1#\u0001\u0000\u0000\u0000\u00f2\u00f3"+
"\u0003\"\u0011\u0000\u00f3\u00f4\u0003\u0006\u0003\u0000\u00f4\u00f5\u0003"+
"\u001c\u000e\u0000\u00f5%\u0001\u0000\u0000\u0000\u00f6\u00f7\u0005\u0016"+
"\u0000\u0000\u00f7\u00f9\u0005\u0012\u0000\u0000\u00f8\u00f6\u0001\u0000"+
"\u0000\u0000\u00f8\u00f9\u0001\u0000\u0000\u0000\u00f9\u00ff\u0001\u0000"+
"\u0000\u0000\u00fa\u00fb\u0003(\u0014\u0000\u00fb\u00fc\u0005\u0012\u0000"+
"\u0000\u00fc\u00fe\u0001\u0000\u0000\u0000\u00fd\u00fa\u0001\u0000\u0000"+
"\u0000\u00fe\u0101\u0001\u0000\u0000\u0000\u00ff\u00fd\u0001\u0000\u0000"+
"\u0000\u00ff\u0100\u0001\u0000\u0000\u0000\u0100\u0102\u0001\u0000\u0000"+
"\u0000\u0101\u00ff\u0001\u0000\u0000\u0000\u0102\u0103\u0003*\u0015\u0000"+
"\u0103\'\u0001\u0000\u0000\u0000\u0104\u0107\u0003*\u0015\u0000\u0105"+
"\u0107\u00030\u0018\u0000\u0106\u0104\u0001\u0000\u0000\u0000\u0106\u0105"+
"\u0001\u0000\u0000\u0000\u0107)\u0001\u0000\u0000\u0000\u0108\u0109\u0003"+
"0\u0018\u0000\u0109\u010b\u0005\u0005\u0000\u0000\u010a\u010c\u0003,\u0016"+
"\u0000\u010b\u010a\u0001\u0000\u0000\u0000\u010b\u010c\u0001\u0000\u0000"+
"\u0000\u010c\u010d\u0001\u0000\u0000\u0000\u010d\u010e\u0005\u0006\u0000"+
"\u0000\u010e+\u0001\u0000\u0000\u0000\u010f\u0114\u0003\u001c\u000e\u0000"+
"\u0110\u0111\u0005\n\u0000\u0000\u0111\u0113\u0003\u001c\u000e\u0000\u0112"+
"\u0110\u0001\u0000\u0000\u0000\u0113\u0116\u0001\u0000\u0000\u0000\u0114"+
"\u0112\u0001\u0000\u0000\u0000\u0114\u0115\u0001\u0000\u0000\u0000\u0115"+
"-\u0001\u0000\u0000\u0000\u0116\u0114\u0001\u0000\u0000\u0000\u0117\u0118"+
"\u0007\u0003\u0000\u0000\u0118/\u0001\u0000\u0000\u0000\u0119\u011a\u0005"+
"-\u0000\u0000\u011a1\u0001\u0000\u0000\u0000\u00197<>DRX_q{\u0084\u0086"+
"\u0092\u00ab\u00bb\u00c2\u00c6\u00d5\u00dd\u00e6\u00ed\u00f8\u00ff\u0106"+
"\u010b\u0114";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@ -1,4 +1,4 @@
// Generated from C:/dev/Pressmium/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
// Generated from C:/Users/laure/Documents/Dev/Compilerbau/Projekt/CompilerULTIMATE/src/main/antlr/Decaf.g4 by ANTLR 4.13.1
package de.maishai.antlr;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
@ -201,6 +201,13 @@ public interface DecafVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitBinaryOperation(DecafParser.BinaryOperationContext ctx);
/**
* Visit a parse tree produced by the {@code This}
* labeled alternative in {@link DecafParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitThis(DecafParser.ThisContext ctx);
/**
* Visit a parse tree produced by the {@code StatementExpressionexpr}
* labeled alternative in {@link DecafParser#expr}.

View File

@ -1,5 +1,5 @@
package de.maishai.ast.records;
public sealed interface Expression extends Node permits Binary, BoolLiteral, CharLiteral, FieldVarAccess, IntLiteral, MethodCall, New, Unary {
public sealed interface Expression extends Node permits Binary, BoolLiteral, CharLiteral, FieldVarAccess, IntLiteral, MethodCall, New, Null, This, Unary {
}

View File

@ -0,0 +1,5 @@
package de.maishai.ast.records;
public record Null() implements Expression {
}

View File

@ -0,0 +1,5 @@
package de.maishai.ast.records;
public record This() implements Expression {
}