Implemented the attribute operator, using a period

This commit is contained in:
2026-04-24 11:31:54 +10:00
parent d2ac1eeb8e
commit 9a75226491
7 changed files with 94 additions and 1 deletions
+9
View File
@@ -33,6 +33,7 @@ typedef enum Toy_AstType {
TOY_AST_FN_DECLARE,
TOY_AST_FN_INVOKE,
TOY_AST_ATTRIBUTE,
TOY_AST_STACK_POP, //BUGFIX: force a single stack pop for expression statements
@@ -219,6 +220,12 @@ typedef struct Toy_AstFnInvoke {
Toy_Ast* args;
} Toy_AstFnInvoke;
typedef struct Toy_AstAttribute {
Toy_AstType type;
Toy_Ast* left;
Toy_Ast* right;
} Toy_AstAttribute;
typedef struct Toy_AstStackPop {
Toy_AstType type;
Toy_Ast* child;
@@ -259,6 +266,7 @@ union Toy_Ast { //see 'test_ast.c' for bitness tests
Toy_AstVarAccess varAccess;
Toy_AstFnDeclare fnDeclare;
Toy_AstFnInvoke fnInvoke;
Toy_AstAttribute attribute;
Toy_AstStackPop stackPop;
Toy_AstPass pass;
Toy_AstError error;
@@ -291,6 +299,7 @@ void Toy_private_emitAstVariableAccess(Toy_Bucket** bucketHandle, Toy_Ast** astH
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_emitAstAttribute(Toy_Bucket** bucketHandle, Toy_Ast** astHandle, Toy_Ast* expr);
void Toy_private_emitAstStackPop(Toy_Bucket** bucketHandle, Toy_Ast** astHandle);