Functions are successfully called, read more

Return keyword is not yet implemented.

Functions are untested.

See #163
This commit is contained in:
2025-02-17 14:05:07 +11:00
parent 76d89fe0ad
commit 02dfc996b4
12 changed files with 193 additions and 27 deletions

View File

@@ -31,6 +31,7 @@ typedef enum Toy_AstType {
TOY_AST_VAR_ACCESS,
TOY_AST_FN_DECLARE,
TOY_AST_FN_INVOKE,
TOY_AST_PASS,
TOY_AST_ERROR,
@@ -200,6 +201,12 @@ typedef struct Toy_AstFnDeclare {
Toy_Ast* body;
} Toy_AstFnDeclare;
typedef struct Toy_AstFnInvoke {
Toy_AstType type;
Toy_Ast* function;
Toy_Ast* args;
} Toy_AstFnInvoke;
typedef struct Toy_AstPass {
Toy_AstType type;
} Toy_AstPass;
@@ -233,6 +240,7 @@ union Toy_Ast { //see 'test_ast.c' for bitness tests
Toy_AstVarAssign varAssign;
Toy_AstVarAccess varAccess;
Toy_AstFnDeclare fnDeclare;
Toy_AstFnInvoke fnInvoke;
Toy_AstPass pass;
Toy_AstError error;
Toy_AstEnd end;
@@ -262,8 +270,8 @@ void Toy_private_emitAstVariableAssignment(Toy_Bucket** bucketHandle, Toy_Ast**
void Toy_private_emitAstVariableAccess(Toy_Bucket** bucketHandle, Toy_Ast** astHandle);
void Toy_private_emitAstFunctionDeclaration(Toy_Bucket** bucketHandle, Toy_Ast** astHandle, Toy_String* name, Toy_Ast* params, Toy_Ast* body);
void Toy_private_emitAstFunctionInvokation(Toy_Bucket** bucketHandle, Toy_Ast** astHandle, Toy_Ast* params);
void Toy_private_emitAstPass(Toy_Bucket** bucketHandle, Toy_Ast** astHandle);
void Toy_private_emitAstError(Toy_Bucket** bucketHandle, Toy_Ast** astHandle);
void Toy_private_emitAstEnd(Toy_Bucket** bucketHandle, Toy_Ast** astHandle);