From aba7302e7e98fd7bca2056d8ad622d9ca81c495f Mon Sep 17 00:00:00 2001 From: Carlos Maniero Date: Mon, 8 May 2023 23:53:41 -0300 Subject: 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 Reviewed-by: Johnny Richard --- src/ast.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index 5938e1d..8a46034 100644 --- a/src/ast.c +++ b/src/ast.c @@ -117,6 +117,24 @@ ast_node_new_literal_integer(uint32_t number) return node; } +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) { -- cgit v1.2.3