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.c | |
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.c')
-rw-r--r-- | src/ast.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -118,6 +118,24 @@ ast_node_new_literal_integer(uint32_t number) } ast_node_t * +ast_node_new_literal_bool(bool boolean) +{ + ast_node_t *node = ast_node_new(); + + *node = (ast_node_t){ + .kind = AST_LITERAL, + .data = { + .literal = { + .kind = AST_LITERAL_BOOL, + .value = { .boolean = boolean } + }, + }, + }; + + return node; +} + +ast_node_t * ast_node_new_binary_operation(ast_binary_operation_kind_t kind, ast_node_t *left, ast_node_t *right) { ast_node_t *node = ast_node_new(); |