Build the typed ast

This commit is contained in:
ahmad 2024-05-04 10:49:26 +02:00
parent 4646a4d8d1
commit 48fc1dd7b4
24 changed files with 536 additions and 1 deletions

View File

@ -0,0 +1,25 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class Assignment implements Statement {
private Id loc;
private Assignment assignment;
private Expression value;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,24 @@
package de.maishai.typedast.typedclass;
import de.maishai.ast.Operator;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class Binary implements Expression {
private Expression left;
private Operator op;
private Expression right;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,23 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class Block implements Node {
private List<LocalVariable> vars;
private List<Statement> stmts;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,23 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class BoolLiteral implements Expression {
private boolean value;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,20 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class Break implements Statement {
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,21 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class CharLiteral implements Expression {
private char value;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,24 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class Constructor implements Node {
private Id id;
private List<Parameter> params;
private Block block;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class Continue implements Statement {
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,23 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class DoWhile implements Statement {
private Block block;
private Expression cond;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -8,7 +8,7 @@ import java.util.Map;
@Data
public class Field implements Node {
private String name;
private Id id;
private Type type;
@Override

View File

@ -0,0 +1,23 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class FieldId implements Node {
private Boolean field;
private Expression recipient;
private Id id;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,26 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class For implements Statement {
private Expression assign;
private Expression cond;
private Expression inc;
private Block block;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,23 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class Id implements Expression {
private String name;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,25 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class IfElse implements Statement {
private Expression cond;
private Block ifBlock;
private Block elseBlock;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class IntLiteral implements Expression {
private Integer value;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class LocalVariable implements Node {
private Id name;
private Type type;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class MainMethod implements Node {
private Block block;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,28 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class MethodCall implements Expression, Statement {
private Boolean field;
private Expression recipient;
private Id id;
private List<Expression> args;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,25 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class New implements Expression, Statement {
private Type type;
private List<Expression> args;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class Program implements Node {
private List<Class> classes;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,24 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class Return implements Statement {
private Expression ret;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,21 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class ReturnVoid implements Statement {
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,23 @@
package de.maishai.typedast.typedclass;
import de.maishai.ast.UnaryOperator;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class Unary implements Expression {
private UnaryOperator op;
private Expression right;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}

View File

@ -0,0 +1,24 @@
package de.maishai.typedast.typedclass;
import de.maishai.typedast.Expression;
import de.maishai.typedast.Node;
import de.maishai.typedast.Statement;
import de.maishai.typedast.Type;
import lombok.Data;
import java.util.Map;
@Data
public class While implements Statement {
private Expression cond;
private Block block;
@Override
public Type typeCheck(Map<String, Type> localVar, Map<String, Class> classes) {
return null;
}
@Override
public Node convertToTypedAST(Map<String, Type> localVar, Map<String, Class> classes, de.maishai.ast.records.Node c) {
return null;
}
}