mirror of
https://github.com/hazemKrimi/jack-compiler.git
synced 2026-05-01 17:48:57 +00:00
feat: finish compiler
This commit is contained in:
@@ -232,7 +232,7 @@ func compileExpressionList(output *strings.Builder, tokens []tokenizer.Token, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
func compileParameterList(output *strings.Builder, tokens []tokenizer.Token, index *int) error {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,6 +733,7 @@ func compileSubroutineDeclaration(output *strings.Builder, tokens []tokenizer.To
|
|||||||
}
|
}
|
||||||
|
|
||||||
if tokens[*index].Type != tokenizer.SYMBOL || tokens[*index].Value != ")" {
|
if tokens[*index].Type != tokenizer.SYMBOL || tokens[*index].Value != ")" {
|
||||||
|
fmt.Println(tokens[*index].Value, *index)
|
||||||
return errors.New("Missing subroutine closing parenthese!")
|
return errors.New("Missing subroutine closing parenthese!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user