diff options
author | Carlos Maniero <carlos@maniero.me> | 2023-05-08 23:53:41 -0300 |
---|---|---|
committer | Johnny Richard <johnny@johnnyrichard.com> | 2023-05-09 08:50:53 +0200 |
commit | aba7302e7e98fd7bca2056d8ad622d9ca81c495f (patch) | |
tree | 59b4de4d4946f622b97ca7b6e1ded4d1e9cebbe5 /src/ast.h | |
parent | ccd5e8585f10488eed72c772cc1804efea6b8fb4 (diff) |
parser: Add the bool type
This commit introduces a new type for booleans. There is no code
generation for this type yet. The intention of this commit is to enable
flow control in the near future.
Signed-off-by: Carlos Maniero <carlos@maniero.me>
Reviewed-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'src/ast.h')
-rw-r--r-- | src/ast.h | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -22,7 +22,8 @@ typedef enum { - TYPE_I32 + TYPE_I32, + TYPE_BOOL } type_t; typedef struct ast_node_t ast_node_t; @@ -67,12 +68,14 @@ typedef struct ast_binary_operation_t typedef enum { - AST_LITERAL_INTEGER + AST_LITERAL_INTEGER, + AST_LITERAL_BOOL } ast_literal_kind_t; typedef union { uint32_t integer; + bool boolean; } ast_literal_value_t; typedef struct ast_literal_t @@ -148,6 +151,9 @@ ast_node_t * ast_node_new_literal_integer(uint32_t number); ast_node_t * +ast_node_new_literal_bool(bool boolean); + +ast_node_t * ast_node_new_variable(ast_identifier_t *identifier); ast_node_t * |