From 8e7089a5d6ba1f4f50a90133bb50bc5c6c554aff Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 13 Jun 2024 11:00:06 +0200 Subject: Set up visitor (#3) Co-authored-by: geno --- src/ast/nodes/ParamdefNode.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/ast/nodes/ParamdefNode.java (limited to 'src/ast/nodes/ParamdefNode.java') diff --git a/src/ast/nodes/ParamdefNode.java b/src/ast/nodes/ParamdefNode.java new file mode 100644 index 0000000..d8e04f7 --- /dev/null +++ b/src/ast/nodes/ParamdefNode.java @@ -0,0 +1,29 @@ +package com.clp.project.ast.nodes; + +import java.util.ArrayList; + +import com.clp.project.semanticanalysis.SemanticError; +import com.clp.project.semanticanalysis.SymbolTable; + +import com.clp.project.ast.types.*; + +/** + * Node for the `paramdef` statement of the grammar. Extends the `AtomNode` + * class. + */ +public class ParamdefNode extends AtomNode implements Node { + public ParamdefNode(String val) { + super(val); + } + + // FIXME: it should returns the param' type + @Override + public Type typeCheck() { + return new VoidType(); + } + + @Override + public String toPrint(String prefix) { + return prefix + "Paramdef(" + val + ")\n"; + } +} -- cgit v1.2.3-18-g5258