mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Functions are WIP, read more
They're no-ops in compilation for now, and param types aren't parsed. 'return' keyword needs to be implemented. Was distracted by bugfixes in v2 and v2-docs.
This commit is contained in:
@@ -30,6 +30,8 @@ typedef enum Toy_AstType {
|
||||
TOY_AST_VAR_ASSIGN,
|
||||
TOY_AST_VAR_ACCESS,
|
||||
|
||||
TOY_AST_FN_DECLARE,
|
||||
|
||||
TOY_AST_PASS,
|
||||
TOY_AST_ERROR,
|
||||
TOY_AST_END,
|
||||
@@ -191,6 +193,13 @@ typedef struct Toy_AstVarAccess {
|
||||
Toy_Ast* child;
|
||||
} Toy_AstVarAccess;
|
||||
|
||||
typedef struct Toy_AstFnDeclare {
|
||||
Toy_AstType type;
|
||||
Toy_String* name;
|
||||
Toy_Ast* params;
|
||||
Toy_Ast* body;
|
||||
} Toy_AstFnDeclare;
|
||||
|
||||
typedef struct Toy_AstPass {
|
||||
Toy_AstType type;
|
||||
} Toy_AstPass;
|
||||
@@ -223,6 +232,7 @@ union Toy_Ast { //see 'test_ast.c' for bitness tests
|
||||
Toy_AstVarDeclare varDeclare;
|
||||
Toy_AstVarAssign varAssign;
|
||||
Toy_AstVarAccess varAccess;
|
||||
Toy_AstFnDeclare fnDeclare;
|
||||
Toy_AstPass pass;
|
||||
Toy_AstError error;
|
||||
Toy_AstEnd end;
|
||||
@@ -251,6 +261,8 @@ void Toy_private_emitAstVariableDeclaration(Toy_Bucket** bucketHandle, Toy_Ast**
|
||||
void Toy_private_emitAstVariableAssignment(Toy_Bucket** bucketHandle, Toy_Ast** astHandle, Toy_AstFlag flag, Toy_Ast* expr);
|
||||
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_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);
|
||||
|
||||
Reference in New Issue
Block a user