From d45b7a6f8e3f0de09a26cf4c9133908bcb965eb8 Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Wed, 29 Apr 2026 18:20:33 +0100 Subject: [PATCH] feat: finish compiler --- internal/compilation-engine/compilation-engine.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/compilation-engine/compilation-engine.go b/internal/compilation-engine/compilation-engine.go index a711849..05209cd 100644 --- a/internal/compilation-engine/compilation-engine.go +++ b/internal/compilation-engine/compilation-engine.go @@ -232,7 +232,7 @@ func compileExpressionList(output *strings.Builder, tokens []tokenizer.Token, in } func compileParameterList(output *strings.Builder, tokens []tokenizer.Token, index *int) error { - if !slices.Contains([]tokenizer.TokenType{tokenizer.KEYWORD, tokenizer.IDENTIFIER}, tokens[*index].Type) || !slices.Contains([]string{"int", "char", "boolean"}, tokens[*index].Value) { + if !slices.Contains([]tokenizer.TokenType{tokenizer.KEYWORD, tokenizer.IDENTIFIER}, tokens[*index].Type) && !slices.Contains([]string{"int", "char", "boolean"}, tokens[*index].Value) { return nil } @@ -733,6 +733,7 @@ func compileSubroutineDeclaration(output *strings.Builder, tokens []tokenizer.To } if tokens[*index].Type != tokenizer.SYMBOL || tokens[*index].Value != ")" { + fmt.Println(tokens[*index].Value, *index) return errors.New("Missing subroutine closing parenthese!") }