From b50c7e99603e9f85d82d700d62c16c4fcef88715 Mon Sep 17 00:00:00 2001 From: Geno <48206120+gabrielegenovese@users.noreply.github.com> Date: Thu, 11 Jul 2024 12:57:56 +0200 Subject: Code generation (#20) Co-authored-by: geno Co-authored-by: Santo Cariotti --- src/ast/nodes/BlockNode.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/ast/nodes/BlockNode.java') diff --git a/src/ast/nodes/BlockNode.java b/src/ast/nodes/BlockNode.java index 732e89b..2ea0a47 100644 --- a/src/ast/nodes/BlockNode.java +++ b/src/ast/nodes/BlockNode.java @@ -15,12 +15,12 @@ public class BlockNode extends RootNode { } @Override - public ArrayList checkSemantics(SymbolTable ST, int _nesting) { + public ArrayList checkSemantics(SymbolTable ST, int _nesting, FunctionType ft) { ArrayList errors = new ArrayList<>(); // Check semantics for each child for (Node child : childs) { - errors.addAll(child.checkSemantics(ST, _nesting)); + errors.addAll(child.checkSemantics(ST, _nesting, ft)); } return errors; @@ -31,6 +31,17 @@ public class BlockNode extends RootNode { return new VoidType(); } + @Override + public String codeGeneration() { + String str = ""; + + for (Node child : childs) { + str += child.codeGeneration(); + } + + return str; + } + @Override public String toPrint(String prefix) { String str = prefix + "Block\n"; -- cgit v1.2.3-18-g5258