public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
* [PATCH olang v2 0/4] codestyle: change our formater
@ 2024-10-11 16:57 Carlos Maniero
  2024-10-11 16:57 ` [PATCH olang v2 1/4] codestyle: prevent extra empty lines at EOF Carlos Maniero
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Carlos Maniero @ 2024-10-11 16:57 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

After the discussion on the previous patchset[1], we decided to drop the
follow configs:

codestyle: change AlignAfterOpenBracket to BlockIndent
codestyle: never BreakBeforeBraces


[1]: Message-ID <20241010013318.222905-1-carlos@maniero.me>

Carlos Maniero (4):
  codestyle: prevent extra empty lines at EOF
  codestyle: do not allow single line enums
  codestyle: add trailing comma on struct initializer
  codestyle: limit the code to 80 characters

 .clang-format                 |   7 +-
 src/ast.c                     |  60 ++++--
 src/ast.h                     |  38 +++-
 src/checker.c                 |  13 +-
 src/cli.c                     |  34 ++--
 src/codegen_linux_x86_64.c    | 339 ++++++++++++++++++++++++----------
 src/codegen_linux_x86_64.h    |   3 +-
 src/lexer.c                   |  97 +++++++---
 src/main.c                    |  24 ++-
 src/map.c                     |  26 ++-
 src/parser.c                  |  73 ++++++--
 src/pretty_print_ast.c        |  81 +++++---
 src/scope.c                   |   9 +-
 src/string_view.c             |   5 +-
 tests/unit/arena_test.c       |  26 ++-
 tests/unit/list_test.c        |  33 +++-
 tests/unit/map_test.c         |  20 +-
 tests/unit/string_view_test.c |  46 ++++-
 18 files changed, 693 insertions(+), 241 deletions(-)


base-commit: dae44406b4bd25c83c81bc528146d76c797e1b0e
-- 
2.46.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v2 1/4] codestyle: prevent extra empty lines at EOF
  2024-10-11 16:57 [PATCH olang v2 0/4] codestyle: change our formater Carlos Maniero
@ 2024-10-11 16:57 ` Carlos Maniero
  2024-10-11 16:57 ` [PATCH olang v2 2/4] codestyle: do not allow single line enums Carlos Maniero
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Carlos Maniero @ 2024-10-11 16:57 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

Signed-off-by: Carlos Maniero <carlos@maniero.me>
---
 .clang-format | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.clang-format b/.clang-format
index b76afee..b2eb3c5 100644
--- a/.clang-format
+++ b/.clang-format
@@ -131,6 +131,7 @@ InsertTrailingCommas: None
 JavaScriptQuotes: Leave
 JavaScriptWrapImports: true
 KeepEmptyLinesAtTheStartOfBlocks: true
+KeepEmptyLinesAtEOF: false
 LambdaBodyIndentation: Signature
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
-- 
2.46.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v2 2/4] codestyle: do not allow single line enums
  2024-10-11 16:57 [PATCH olang v2 0/4] codestyle: change our formater Carlos Maniero
  2024-10-11 16:57 ` [PATCH olang v2 1/4] codestyle: prevent extra empty lines at EOF Carlos Maniero
@ 2024-10-11 16:57 ` Carlos Maniero
  2024-10-11 16:57 ` [PATCH olang v2 3/4] codestyle: add trailing comma on struct initializer Carlos Maniero
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Carlos Maniero @ 2024-10-11 16:57 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

Signed-off-by: Carlos Maniero <carlos@maniero.me>
---
 .clang-format | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.clang-format b/.clang-format
index b2eb3c5..fa8dbc8 100644
--- a/.clang-format
+++ b/.clang-format
@@ -33,7 +33,7 @@ AlignOperands:   Align
 AlignTrailingComments: true
 AllowAllArgumentsOnNextLine: true
 AllowAllParametersOfDeclarationOnNextLine: false
-AllowShortEnumsOnASingleLine: true
+AllowShortEnumsOnASingleLine: false
 AllowShortBlocksOnASingleLine: Never
 AllowShortCaseLabelsOnASingleLine: false
 AllowShortFunctionsOnASingleLine: Inline
-- 
2.46.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v2 3/4] codestyle: add trailing comma on struct initializer
  2024-10-11 16:57 [PATCH olang v2 0/4] codestyle: change our formater Carlos Maniero
  2024-10-11 16:57 ` [PATCH olang v2 1/4] codestyle: prevent extra empty lines at EOF Carlos Maniero
  2024-10-11 16:57 ` [PATCH olang v2 2/4] codestyle: do not allow single line enums Carlos Maniero
@ 2024-10-11 16:57 ` Carlos Maniero
  2024-10-11 16:57 ` [PATCH olang v2 4/4] codestyle: limit the code to 80 characters Carlos Maniero
  2024-10-12 23:35 ` [PATCH olang v2 0/4] codestyle: change our formater Johnny Richard
  4 siblings, 0 replies; 7+ messages in thread
From: Carlos Maniero @ 2024-10-11 16:57 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

It makes the struct to be formatted that way:

  {
    .a = 1,
    .b = 2,
  }

Instead of:

  { .a = 1,
    .b = 2 }

Unfortunately, there is no config on clang-format to enforce this.

Signed-off-by: Carlos Maniero <carlos@maniero.me>
---
 src/cli.c                     |  5 +++-
 src/lexer.c                   | 51 +++++++++++++++++++++++++++++------
 src/main.c                    |  5 +++-
 src/map.c                     | 14 ++++++++--
 src/string_view.c             |  5 +++-
 tests/unit/string_view_test.c | 20 +++++++++++---
 6 files changed, 83 insertions(+), 17 deletions(-)

diff --git a/src/cli.c b/src/cli.c
index 9d0f875..d6b69e1 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -35,7 +35,10 @@ cli_opts_parse_sysroot(cli_opts_t *opts, cli_args_t *args);
 cli_opts_t
 cli_parse_args(int argc, char **argv)
 {
-    cli_args_t args = { .argc = argc, .argv = argv };
+    cli_args_t args = {
+        .argc = argc,
+        .argv = argv,
+    };
     cli_opts_t opts = { 0 };
 
     opts.compiler_path = cli_args_shift(&args);
diff --git a/src/lexer.c b/src/lexer.c
index c4f645c..03763de 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -90,8 +90,10 @@ lexer_next_token(lexer_t *lexer, token_t *token)
                 current_char = lexer_current_char(lexer);
             }
 
-            string_view_t text = { .chars = lexer->src.code.chars + start_cur.offset,
-                                   .size = lexer->cur.offset - start_cur.offset };
+            string_view_t text = {
+                .chars = lexer->src.code.chars + start_cur.offset,
+                .size = lexer->cur.offset - start_cur.offset,
+            };
 
             lexer_init_str_value_token(lexer, token, lexer_str_to_token_kind(text), start_cur);
             return;
@@ -403,22 +405,52 @@ _isspace(char c)
 static void
 lexer_init_char_value_token(lexer_t *lexer, token_t *token, token_kind_t kind)
 {
-    string_view_t str = { .chars = lexer->src.code.chars + lexer->cur.offset, .size = 1 };
-    *token = (token_t){ .kind = kind, .value = str, .loc = (token_loc_t){ .src = lexer->src, .cur = lexer->cur } };
+    string_view_t str = {
+        .chars = lexer->src.code.chars + lexer->cur.offset,
+        .size = 1,
+    };
+    *token = (token_t){
+        .kind = kind,
+        .value = str,
+        .loc =
+            (token_loc_t){
+                .src = lexer->src,
+                .cur = lexer->cur,
+            },
+    };
 }
 
 static void
 lexer_init_str_value_token(lexer_t *lexer, token_t *token, token_kind_t kind, lexer_cursor_t cur)
 {
-    string_view_t str = { .chars = lexer->src.code.chars + cur.offset, .size = lexer->cur.offset - cur.offset };
-    *token = (token_t){ .kind = kind, .value = str, .loc = (token_loc_t){ .src = lexer->src, .cur = cur } };
+    string_view_t str = {
+        .chars = lexer->src.code.chars + cur.offset,
+        .size = lexer->cur.offset - cur.offset,
+    };
+    *token = (token_t){
+        .kind = kind,
+        .value = str,
+        .loc =
+            (token_loc_t){
+                .src = lexer->src,
+                .cur = cur,
+            },
+    };
 }
 
 static void
 lexer_init_eof_token(lexer_t *lexer, token_t *token)
 {
     string_view_t str = { 0 };
-    *token = (token_t){ .kind = TOKEN_EOF, .value = str, .loc = (token_loc_t){ .src = lexer->src, .cur = lexer->cur } };
+    *token = (token_t){
+        .kind = TOKEN_EOF,
+        .value = str,
+        .loc =
+            (token_loc_t){
+                .src = lexer->src,
+                .cur = lexer->cur,
+            },
+    };
 }
 
 static token_kind_t
@@ -473,7 +505,10 @@ string_view_t
 token_loc_to_line(token_loc_t loc)
 {
     size_t offset = loc.cur.bol;
-    string_view_t line = { .chars = loc.src.code.chars + offset, .size = 0 };
+    string_view_t line = {
+        .chars = loc.src.code.chars + offset,
+        .size = 0,
+    };
 
     while ((line.size + offset) < loc.src.code.size && line.chars[line.size] != '\n' && line.chars[line.size] != 0) {
         ++line.size;
diff --git a/src/main.c b/src/main.c
index d1c76e3..aa09f34 100644
--- a/src/main.c
+++ b/src/main.c
@@ -238,7 +238,10 @@ read_entire_file(char *filepath, arena_t *arena)
 
     fclose(stream);
 
-    return (source_code_t){ .filepath = filepath, .code = code };
+    return (source_code_t){
+        .filepath = filepath,
+        .code = code,
+    };
 }
 
 static void
diff --git a/src/map.c b/src/map.c
index a6bc3a3..42801b0 100644
--- a/src/map.c
+++ b/src/map.c
@@ -86,7 +86,12 @@ map_put(map_t *map, char *key, void *value)
     map_entry_t *entry = map->entries + map_get_index(map, hash);
 
     if (entry->key == NULL) {
-        *entry = (map_entry_t){ .key = _strdup(key, map->arena), .hash = hash, .value = value, .next = NULL };
+        *entry = (map_entry_t){
+            .key = _strdup(key, map->arena),
+            .hash = hash,
+            .value = value,
+            .next = NULL,
+        };
         return true;
     }
 
@@ -97,7 +102,12 @@ map_put(map_t *map, char *key, void *value)
         }
         if (entry->next == NULL) {
             entry->next = (map_entry_t *)arena_alloc(map->arena, sizeof(map_entry_t));
-            *entry->next = (map_entry_t){ .key = _strdup(key, map->arena), .hash = hash, .value = value, .next = NULL };
+            *entry->next = (map_entry_t){
+                .key = _strdup(key, map->arena),
+                .hash = hash,
+                .value = value,
+                .next = NULL,
+            };
 
             break;
         }
diff --git a/src/string_view.c b/src/string_view.c
index b4d4103..13d359c 100644
--- a/src/string_view.c
+++ b/src/string_view.c
@@ -24,7 +24,10 @@
 string_view_t
 string_view_from_cstr(char *cstr)
 {
-    return (string_view_t){ .chars = cstr, .size = strlen(cstr) };
+    return (string_view_t){
+        .chars = cstr,
+        .size = strlen(cstr),
+    };
 }
 
 bool
diff --git a/tests/unit/string_view_test.c b/tests/unit/string_view_test.c
index 7a6776c..d85f19b 100644
--- a/tests/unit/string_view_test.c
+++ b/tests/unit/string_view_test.c
@@ -26,14 +26,20 @@ string_view_eq_to_cstr_test(const MunitParameter params[], void *user_data_or_fi
 {
     char *name = "John Doe";
 
-    string_view_t str = { .chars = name, .size = strlen(name) };
+    string_view_t str = {
+        .chars = name,
+        .size = strlen(name),
+    };
 
     assert_true(string_view_eq_to_cstr(str, "John Doe"));
     assert_false(string_view_eq_to_cstr(str, "Doe"));
 
     char *return_stmt = "return EXIT_SUCCESS;";
 
-    str = (string_view_t){ .chars = return_stmt + 7, .size = 12 };
+    str = (string_view_t){
+        .chars = return_stmt + 7,
+        .size = 12,
+    };
     assert_true(string_view_eq_to_cstr(str, "EXIT_SUCCESS"));
 
     return MUNIT_OK;
@@ -44,11 +50,17 @@ string_view_to_u32_test(const MunitParameter params[], void *user_data_or_fixtur
 {
     char *number = "69";
 
-    string_view_t str = { .chars = number, .size = strlen(number) };
+    string_view_t str = {
+        .chars = number,
+        .size = strlen(number),
+    };
 
     assert_uint32(string_view_to_u32(str), ==, 69);
 
-    str = (string_view_t){ .chars = "39;", .size = 2 };
+    str = (string_view_t){
+        .chars = "39;",
+        .size = 2,
+    };
 
     assert_uint32(string_view_to_u32(str), ==, 39);
 
-- 
2.46.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v2 4/4] codestyle: limit the code to 80 characters
  2024-10-11 16:57 [PATCH olang v2 0/4] codestyle: change our formater Carlos Maniero
                   ` (2 preceding siblings ...)
  2024-10-11 16:57 ` [PATCH olang v2 3/4] codestyle: add trailing comma on struct initializer Carlos Maniero
@ 2024-10-11 16:57 ` Carlos Maniero
  2024-10-11 16:58   ` [olang/patches/.build.yml] build success builds.sr.ht
  2024-10-12 23:35 ` [PATCH olang v2 0/4] codestyle: change our formater Johnny Richard
  4 siblings, 1 reply; 7+ messages in thread
From: Carlos Maniero @ 2024-10-11 16:57 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

Signed-off-by: Carlos Maniero <carlos@maniero.me>
---
 .clang-format                 |   4 +-
 src/ast.c                     |  60 ++++--
 src/ast.h                     |  38 +++-
 src/checker.c                 |  13 +-
 src/cli.c                     |  29 +--
 src/codegen_linux_x86_64.c    | 339 ++++++++++++++++++++++++----------
 src/codegen_linux_x86_64.h    |   3 +-
 src/lexer.c                   |  46 +++--
 src/main.c                    |  19 +-
 src/map.c                     |  12 +-
 src/parser.c                  |  73 ++++++--
 src/pretty_print_ast.c        |  81 +++++---
 src/scope.c                   |   9 +-
 tests/unit/arena_test.c       |  26 ++-
 tests/unit/list_test.c        |  33 +++-
 tests/unit/map_test.c         |  20 +-
 tests/unit/string_view_test.c |  26 ++-
 17 files changed, 608 insertions(+), 223 deletions(-)

diff --git a/.clang-format b/.clang-format
index fa8dbc8..f7c0cc7 100644
--- a/.clang-format
+++ b/.clang-format
@@ -77,7 +77,7 @@ BreakConstructorInitializersBeforeComma: false
 BreakConstructorInitializers: BeforeComma
 BreakAfterJavaFieldAnnotations: false
 BreakStringLiterals: true
-ColumnLimit:     120
+ColumnLimit:     80
 CommentPragmas:  '^ IWYU pragma:'
 QualifierAlignment: Leave
 CompactNamespaces: false
@@ -145,7 +145,7 @@ ObjCSpaceBeforeProtocolList: false
 PenaltyBreakAssignment: 2
 PenaltyBreakBeforeFirstCallParameter: 19
 PenaltyBreakComment: 300
-PenaltyBreakFirstLessLess: 120
+PenaltyBreakFirstLessLess: 80
 PenaltyBreakOpenParenthesis: 0
 PenaltyBreakString: 1000
 PenaltyBreakTemplateDeclaration: 10
diff --git a/src/ast.c b/src/ast.c
index c64e660..800239e 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -51,7 +51,8 @@ ast_new_node_fn_def(arena_t *arena,
     assert(params);
     assert(block);
 
-    ast_node_t *node_fn_def = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_fn_def =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_fn_def);
 
     node_fn_def->kind = AST_NODE_FN_DEF;
@@ -67,12 +68,16 @@ ast_new_node_fn_def(arena_t *arena,
 }
 
 ast_node_t *
-ast_new_node_fn_call(arena_t *arena, token_loc_t loc, string_view_t id, list_t *args)
+ast_new_node_fn_call(arena_t *arena,
+                     token_loc_t loc,
+                     string_view_t id,
+                     list_t *args)
 {
     assert(arena);
     assert(args);
 
-    ast_node_t *node_fn_call = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_fn_call =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_fn_call);
 
     node_fn_call->kind = AST_NODE_FN_CALL;
@@ -86,9 +91,14 @@ ast_new_node_fn_call(arena_t *arena, token_loc_t loc, string_view_t id, list_t *
 }
 
 ast_node_t *
-ast_new_node_var_def(arena_t *arena, token_loc_t loc, string_view_t id, type_t *type, ast_node_t *value)
+ast_new_node_var_def(arena_t *arena,
+                     token_loc_t loc,
+                     string_view_t id,
+                     type_t *type,
+                     ast_node_t *value)
 {
-    ast_node_t *node_var_def = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_var_def =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_var_def);
 
     node_var_def->kind = AST_NODE_VAR_DEF;
@@ -103,9 +113,14 @@ ast_new_node_var_def(arena_t *arena, token_loc_t loc, string_view_t id, type_t *
 }
 
 ast_node_t *
-ast_new_node_bin_op(arena_t *arena, token_loc_t loc, ast_binary_op_kind_t kind, ast_node_t *lhs, ast_node_t *rhs)
+ast_new_node_bin_op(arena_t *arena,
+                    token_loc_t loc,
+                    ast_binary_op_kind_t kind,
+                    ast_node_t *lhs,
+                    ast_node_t *rhs)
 {
-    ast_node_t *node_bin_op = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_bin_op =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_bin_op);
 
     node_bin_op->kind = AST_NODE_BINARY_OP;
@@ -118,9 +133,13 @@ ast_new_node_bin_op(arena_t *arena, token_loc_t loc, ast_binary_op_kind_t kind,
 }
 
 ast_node_t *
-ast_new_node_unary_op(arena_t *arena, token_loc_t loc, ast_unary_op_kind_t kind, ast_node_t *expr)
+ast_new_node_unary_op(arena_t *arena,
+                      token_loc_t loc,
+                      ast_unary_op_kind_t kind,
+                      ast_node_t *expr)
 {
-    ast_node_t *node_unary_op = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_unary_op =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_unary_op);
 
     node_unary_op->kind = AST_NODE_UNARY_OP;
@@ -134,7 +153,8 @@ ast_new_node_unary_op(arena_t *arena, token_loc_t loc, ast_unary_op_kind_t kind,
 ast_node_t *
 ast_new_node_literal_u32(arena_t *arena, token_loc_t loc, uint32_t value)
 {
-    ast_node_t *node_literal = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_literal =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_literal);
 
     node_literal->kind = AST_NODE_LITERAL;
@@ -161,7 +181,8 @@ ast_new_node_ref(arena_t *arena, token_loc_t loc, string_view_t id)
 ast_node_t *
 ast_new_node_return_stmt(arena_t *arena, token_loc_t loc, ast_node_t *expr)
 {
-    ast_node_t *node_return_stmt = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_return_stmt =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_return_stmt);
 
     node_return_stmt->kind = AST_NODE_RETURN_STMT;
@@ -172,7 +193,11 @@ ast_new_node_return_stmt(arena_t *arena, token_loc_t loc, ast_node_t *expr)
 }
 
 ast_node_t *
-ast_new_node_if_stmt(arena_t *arena, token_loc_t loc, ast_node_t *cond, ast_node_t *then, ast_node_t *_else)
+ast_new_node_if_stmt(arena_t *arena,
+                     token_loc_t loc,
+                     ast_node_t *cond,
+                     ast_node_t *then,
+                     ast_node_t *_else)
 {
     ast_node_t *node_if_stmt = arena_alloc(arena, sizeof(ast_node_t));
     assert(node_if_stmt);
@@ -187,7 +212,10 @@ ast_new_node_if_stmt(arena_t *arena, token_loc_t loc, ast_node_t *cond, ast_node
 }
 
 ast_node_t *
-ast_new_node_while_stmt(arena_t *arena, token_loc_t loc, ast_node_t *cond, ast_node_t *then)
+ast_new_node_while_stmt(arena_t *arena,
+                        token_loc_t loc,
+                        ast_node_t *cond,
+                        ast_node_t *then)
 {
     ast_node_t *node_while_stmt = arena_alloc(arena, sizeof(ast_node_t));
     assert(node_while_stmt);
@@ -203,7 +231,8 @@ ast_new_node_while_stmt(arena_t *arena, token_loc_t loc, ast_node_t *cond, ast_n
 ast_node_t *
 ast_new_node_block(arena_t *arena)
 {
-    ast_node_t *node_block = (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
+    ast_node_t *node_block =
+        (ast_node_t *)arena_alloc(arena, sizeof(ast_node_t));
     assert(node_block);
 
     node_block->kind = AST_NODE_BLOCK;
@@ -219,7 +248,8 @@ ast_new_node_block(arena_t *arena)
 ast_fn_param_t *
 ast_new_fn_param(arena_t *arena, string_view_t id, type_t *type)
 {
-    ast_fn_param_t *fn_param = (ast_fn_param_t *)arena_alloc(arena, sizeof(ast_fn_param_t));
+    ast_fn_param_t *fn_param =
+        (ast_fn_param_t *)arena_alloc(arena, sizeof(ast_fn_param_t));
     assert(fn_param);
 
     fn_param->id = id;
diff --git a/src/ast.h b/src/ast.h
index 6da11cf..217a264 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -229,16 +229,30 @@ ast_new_node_fn_def(arena_t *arena,
                     ast_node_t *block);
 
 ast_node_t *
-ast_new_node_fn_call(arena_t *arena, token_loc_t loc, string_view_t id, list_t *args);
+ast_new_node_fn_call(arena_t *arena,
+                     token_loc_t loc,
+                     string_view_t id,
+                     list_t *args);
 
 ast_node_t *
-ast_new_node_var_def(arena_t *arena, token_loc_t loc, string_view_t id, type_t *type, ast_node_t *value);
+ast_new_node_var_def(arena_t *arena,
+                     token_loc_t loc,
+                     string_view_t id,
+                     type_t *type,
+                     ast_node_t *value);
 
 ast_node_t *
-ast_new_node_bin_op(arena_t *arena, token_loc_t loc, ast_binary_op_kind_t kind, ast_node_t *lhs, ast_node_t *rhs);
+ast_new_node_bin_op(arena_t *arena,
+                    token_loc_t loc,
+                    ast_binary_op_kind_t kind,
+                    ast_node_t *lhs,
+                    ast_node_t *rhs);
 
 ast_node_t *
-ast_new_node_unary_op(arena_t *arena, token_loc_t loc, ast_unary_op_kind_t kind, ast_node_t *expr);
+ast_new_node_unary_op(arena_t *arena,
+                      token_loc_t loc,
+                      ast_unary_op_kind_t kind,
+                      ast_node_t *expr);
 
 ast_node_t *
 ast_new_node_literal_u32(arena_t *arena, token_loc_t loc, uint32_t value);
@@ -247,16 +261,26 @@ ast_node_t *
 ast_new_node_ref(arena_t *arena, token_loc_t loc, string_view_t id);
 
 ast_node_t *
-ast_new_node_var_assign_stmt(arena_t *arena, token_loc_t loc, ast_node_t *ref, ast_node_t *expr);
+ast_new_node_var_assign_stmt(arena_t *arena,
+                             token_loc_t loc,
+                             ast_node_t *ref,
+                             ast_node_t *expr);
 
 ast_node_t *
 ast_new_node_return_stmt(arena_t *arena, token_loc_t loc, ast_node_t *expr);
 
 ast_node_t *
-ast_new_node_if_stmt(arena_t *arena, token_loc_t loc, ast_node_t *cond, ast_node_t *then, ast_node_t *_else);
+ast_new_node_if_stmt(arena_t *arena,
+                     token_loc_t loc,
+                     ast_node_t *cond,
+                     ast_node_t *then,
+                     ast_node_t *_else);
 
 ast_node_t *
-ast_new_node_while_stmt(arena_t *arena, token_loc_t loc, ast_node_t *cond, ast_node_t *then);
+ast_new_node_while_stmt(arena_t *arena,
+                        token_loc_t loc,
+                        ast_node_t *cond,
+                        ast_node_t *then);
 
 ast_node_t *
 ast_new_node_block(arena_t *arena);
diff --git a/src/checker.c b/src/checker.c
index e06cfe9..1230c3c 100644
--- a/src/checker.c
+++ b/src/checker.c
@@ -30,7 +30,9 @@ checker_new(arena_t *arena)
 
     checker_t *checker = (checker_t *)arena_alloc(arena, sizeof(checker_t));
     if (checker == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: checker_new: %s\n", strerror(errno));
+        fprintf(stderr,
+                "[FATAL] Out of memory: checker_new: %s\n",
+                strerror(errno));
         exit(EXIT_FAILURE);
     }
     checker->arena = arena;
@@ -119,7 +121,8 @@ populate_scope(checker_t *checker, scope_t *scope, ast_node_t *ast)
             fn_def->scope = scope_push(scope);
 
             type_resolve(fn_def->return_type);
-            symbol_t *symbol = symbol_new(checker->arena, fn_def->id, fn_def->return_type);
+            symbol_t *symbol =
+                symbol_new(checker->arena, fn_def->id, fn_def->return_type);
             scope_insert(scope, symbol);
 
             list_item_t *item = list_head(fn_def->params);
@@ -128,7 +131,8 @@ populate_scope(checker_t *checker, scope_t *scope, ast_node_t *ast)
                 ast_fn_param_t *param = (ast_fn_param_t *)item->value;
 
                 type_resolve(param->type);
-                symbol_t *symbol = symbol_new(checker->arena, param->id, param->type);
+                symbol_t *symbol =
+                    symbol_new(checker->arena, param->id, param->type);
                 scope_insert(fn_def->scope, symbol);
 
                 item = list_next(item);
@@ -210,7 +214,8 @@ populate_scope(checker_t *checker, scope_t *scope, ast_node_t *ast)
 
             type_resolve(ast->as_var_def.type);
 
-            symbol_t *symbol = symbol_new(checker->arena, id, ast->as_var_def.type);
+            symbol_t *symbol =
+                symbol_new(checker->arena, id, ast->as_var_def.type);
 
             scope_insert(scope, symbol);
             ast->as_var_def.scope = scope;
diff --git a/src/cli.c b/src/cli.c
index d6b69e1..2f61acb 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -65,7 +65,8 @@ cli_parse_args(int argc, char **argv)
         arg = cli_args_shift(&args);
     }
 
-    if (opts.options & CLI_OPT_OUTPUT || opts.options & CLI_OPT_DUMP_TOKENS || opts.options & CLI_OPT_DUMP_AST) {
+    if (opts.options & CLI_OPT_OUTPUT || opts.options & CLI_OPT_DUMP_TOKENS ||
+        opts.options & CLI_OPT_DUMP_AST) {
         return opts;
     }
 
@@ -110,7 +111,9 @@ cli_opts_parse_arch(cli_opts_t *opts, cli_args_t *args)
     char *arch = cli_args_shift(args);
 
     if (arch == NULL) {
-        fprintf(stderr, "error: missing architecture for arg '--arch': available options (x86_64 | aarch64)\n");
+        fprintf(stderr,
+                "error: missing architecture for arg '--arch': available "
+                "options (x86_64 | aarch64)\n");
         cli_print_usage(stderr, opts->compiler_path);
         exit(EXIT_FAILURE);
     }
@@ -140,14 +143,16 @@ cli_opts_parse_sysroot(cli_opts_t *opts, cli_args_t *args)
 void
 cli_print_usage(FILE *stream, char *compiler_path)
 {
-    fprintf(stream,
-            "Usage: %s [options] file...\n"
-            "Options:\n"
-            "  --dump-tokens    Display lexer token stream\n"
-            "  --dump-ast       Display ast tree to stdout\n"
-            "  --arch <arch>    Binary arch: default to x86_64 (x86_64 | aarch64)\n"
-            "  --sysroot <dir>  System root dir where the GNU Assembler and GNU Linker are located: default to '/'\n"
-            "  -o <file>        Compile program into a binary file\n"
-            "  --save-temps     Keep temp files used to compile program\n",
-            compiler_path);
+    fprintf(
+        stream,
+        "Usage: %s [options] file...\n"
+        "Options:\n"
+        "  --dump-tokens    Display lexer token stream\n"
+        "  --dump-ast       Display ast tree to stdout\n"
+        "  --arch <arch>    Binary arch: default to x86_64 (x86_64 | aarch64)\n"
+        "  --sysroot <dir>  System root dir where the GNU Assembler and GNU "
+        "Linker are located: default to '/'\n"
+        "  -o <file>        Compile program into a binary file\n"
+        "  --save-temps     Keep temp files used to compile program\n",
+        compiler_path);
 }
diff --git a/src/codegen_linux_x86_64.c b/src/codegen_linux_x86_64.c
index 8a73263..053963a 100644
--- a/src/codegen_linux_x86_64.c
+++ b/src/codegen_linux_x86_64.c
@@ -58,22 +58,28 @@ typedef enum x86_64_register_type
  * ──────────────────────────────────────────────────────────────
  * x86-64        rdi   rsi   rdx   r10   r8    r9    -
  */
-static int x86_call_args[X86_CALL_ARG_SIZE] = { REG_DEST_IDX, REG_SRC_IDX, REG_DATA, REG_R10, REG_R8, REG_R9 };
+static int x86_call_args[X86_CALL_ARG_SIZE] = { REG_DEST_IDX, REG_SRC_IDX,
+                                                REG_DATA,     REG_R10,
+                                                REG_R8,       REG_R9 };
 
 static void
 codegen_linux_x86_64_emit_start_entrypoint(codegen_x86_64_t *codegen);
 
 static void
-codegen_linux_x86_64_emit_function(codegen_x86_64_t *codegen, ast_fn_definition_t *fn);
+codegen_linux_x86_64_emit_function(codegen_x86_64_t *codegen,
+                                   ast_fn_definition_t *fn);
 
 static void
 codegen_linux_x86_64_emit_if(codegen_x86_64_t *codegen, ast_if_stmt_t is_stmt);
 
 static void
-codegen_linux_x86_64_put_stack_offset(codegen_x86_64_t *codegen, symbol_t *symbol, size_t offset);
+codegen_linux_x86_64_put_stack_offset(codegen_x86_64_t *codegen,
+                                      symbol_t *symbol,
+                                      size_t offset);
 
 static size_t
-codegen_linux_x86_64_get_stack_offset(codegen_x86_64_t *codegen, symbol_t *symbol);
+codegen_linux_x86_64_get_stack_offset(codegen_x86_64_t *codegen,
+                                      symbol_t *symbol);
 
 static size_t
 type_to_bytes(type_t *type);
@@ -94,7 +100,8 @@ codegen_linux_x86_64_init(codegen_x86_64_t *codegen, arena_t *arena, FILE *out)
 }
 
 void
-codegen_linux_x86_64_emit_translation_unit(codegen_x86_64_t *codegen, ast_node_t *node)
+codegen_linux_x86_64_emit_translation_unit(codegen_x86_64_t *codegen,
+                                           ast_node_t *node)
 {
     codegen->label_index = 0;
     codegen_linux_x86_64_emit_start_entrypoint(codegen);
@@ -146,7 +153,8 @@ codegen_linux_x86_64_get_next_label(codegen_x86_64_t *codegen)
 typedef size_t size_in_bytes_t;
 
 static size_in_bytes_t
-codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr_node)
+codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen,
+                                     ast_node_t *expr_node)
 {
     switch (expr_node->kind) {
         case AST_NODE_LITERAL: {
@@ -163,11 +171,15 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
             symbol_t *symbol = scope_lookup(ref.scope, ref.id);
             assert(symbol);
 
-            size_t offset = codegen_linux_x86_64_get_stack_offset(codegen, symbol);
+            size_t offset =
+                codegen_linux_x86_64_get_stack_offset(codegen, symbol);
 
             size_t bytes = type_to_bytes(symbol->type);
 
-            fprintf(codegen->out, "    mov -%ld(%%rbp), %s\n", offset, get_reg_for(REG_ACCUMULATOR, bytes));
+            fprintf(codegen->out,
+                    "    mov -%ld(%%rbp), %s\n",
+                    offset,
+                    get_reg_for(REG_ACCUMULATOR, bytes));
             return bytes;
         }
         case AST_NODE_FN_CALL: {
@@ -177,7 +189,8 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
             assert(symbol);
 
             size_t i = 0;
-            for (list_item_t *item = list_head(fn_call.args); item != NULL; item = list_next(item)) {
+            for (list_item_t *item = list_head(fn_call.args); item != NULL;
+                 item = list_next(item)) {
                 // FIXME: add support for more args than X86_CALL_ARG_SIZE
                 assert(i < X86_CALL_ARG_SIZE);
 
@@ -185,12 +198,16 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
 
                 codegen_linux_x86_64_emit_expression(codegen, arg_node);
 
-                fprintf(codegen->out, "    push %s\n", get_reg_for(REG_ACCUMULATOR, 8));
+                fprintf(codegen->out,
+                        "    push %s\n",
+                        get_reg_for(REG_ACCUMULATOR, 8));
                 ++i;
             }
 
             for (; i > 0; --i) {
-                fprintf(codegen->out, "    pop %s\n", get_reg_for(x86_call_args[i - 1], 8));
+                fprintf(codegen->out,
+                        "    pop %s\n",
+                        get_reg_for(x86_call_args[i - 1], 8));
             }
 
             fprintf(codegen->out, "    call " SV_FMT "\n", SV_ARG(fn_call.id));
@@ -202,13 +219,18 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
             switch (bin_op.kind) {
                 case AST_BINOP_ADDITION: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -220,48 +242,69 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                 }
                 case AST_BINOP_MULTIPLICATION: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
-                    fprintf(codegen->out, "    mul %s\n", get_reg_for(REG_COUNTER, expr_bytes));
+                    fprintf(codegen->out,
+                            "    mul %s\n",
+                            get_reg_for(REG_COUNTER, expr_bytes));
 
                     return expr_bytes;
                 }
                 case AST_BINOP_DIVISION: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out, "    xor %%rdx, %%rdx\n");
-                    fprintf(codegen->out, "    div %s\n", get_reg_for(REG_COUNTER, expr_bytes));
+                    fprintf(codegen->out,
+                            "    div %s\n",
+                            get_reg_for(REG_COUNTER, expr_bytes));
 
                     return expr_bytes;
                 }
                 case AST_BINOP_REMINDER: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out, "    xor %%rdx, %%rdx\n");
-                    fprintf(codegen->out, "    div %s\n", get_reg_for(REG_COUNTER, expr_bytes));
+                    fprintf(codegen->out,
+                            "    div %s\n",
+                            get_reg_for(REG_COUNTER, expr_bytes));
                     fprintf(codegen->out,
                             "    mov %s, %s\n",
                             get_reg_for(REG_DATA, expr_bytes),
@@ -271,13 +314,18 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                 }
                 case AST_BINOP_SUBTRACTION: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -289,13 +337,18 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                 }
                 case AST_BINOP_CMP_EQ: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -303,19 +356,26 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                             get_reg_for(REG_COUNTER, expr_bytes),
                             get_reg_for(REG_ACCUMULATOR, expr_bytes));
                     fprintf(codegen->out, "    sete %%al\n");
-                    fprintf(codegen->out, "    movzb %%al, %s\n", get_reg_for(REG_ACCUMULATOR, expr_bytes));
+                    fprintf(codegen->out,
+                            "    movzb %%al, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, expr_bytes));
 
                     return expr_bytes;
                 }
                 case AST_BINOP_CMP_LT: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -323,19 +383,26 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                             get_reg_for(REG_COUNTER, expr_bytes),
                             get_reg_for(REG_ACCUMULATOR, expr_bytes));
                     fprintf(codegen->out, "    setl %%al\n");
-                    fprintf(codegen->out, "    movzb %%al, %s\n", get_reg_for(REG_ACCUMULATOR, expr_bytes));
+                    fprintf(codegen->out,
+                            "    movzb %%al, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, expr_bytes));
 
                     return expr_bytes;
                 }
                 case AST_BINOP_CMP_GT: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -343,19 +410,26 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                             get_reg_for(REG_COUNTER, expr_bytes),
                             get_reg_for(REG_ACCUMULATOR, expr_bytes));
                     fprintf(codegen->out, "    setg %%al\n");
-                    fprintf(codegen->out, "    movzb %%al, %s\n", get_reg_for(REG_ACCUMULATOR, expr_bytes));
+                    fprintf(codegen->out,
+                            "    movzb %%al, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, expr_bytes));
 
                     return expr_bytes;
                 }
                 case AST_BINOP_CMP_NEQ: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -363,19 +437,26 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                             get_reg_for(REG_COUNTER, expr_bytes),
                             get_reg_for(REG_ACCUMULATOR, expr_bytes));
                     fprintf(codegen->out, "    setne %%al\n");
-                    fprintf(codegen->out, "    movzb %%al, %s\n", get_reg_for(REG_ACCUMULATOR, expr_bytes));
+                    fprintf(codegen->out,
+                            "    movzb %%al, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, expr_bytes));
 
                     return expr_bytes;
                 }
                 case AST_BINOP_CMP_LEQ: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -383,19 +464,26 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                             get_reg_for(REG_COUNTER, expr_bytes),
                             get_reg_for(REG_ACCUMULATOR, expr_bytes));
                     fprintf(codegen->out, "    setle %%al\n");
-                    fprintf(codegen->out, "    movzb %%al, %s\n", get_reg_for(REG_ACCUMULATOR, expr_bytes));
+                    fprintf(codegen->out,
+                            "    movzb %%al, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, expr_bytes));
 
                     return expr_bytes;
                 }
                 case AST_BINOP_CMP_GEQ: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -403,7 +491,9 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                             get_reg_for(REG_COUNTER, expr_bytes),
                             get_reg_for(REG_ACCUMULATOR, expr_bytes));
                     fprintf(codegen->out, "    setge %%al\n");
-                    fprintf(codegen->out, "    movzb %%al, %s\n", get_reg_for(REG_ACCUMULATOR, expr_bytes));
+                    fprintf(codegen->out,
+                            "    movzb %%al, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, expr_bytes));
 
                     return expr_bytes;
                 }
@@ -413,10 +503,14 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
-                    fprintf(codegen->out, "    shl %%cl, %s\n", get_reg_for(REG_ACCUMULATOR, lhs_bytes));
+                    fprintf(codegen->out,
+                            "    shl %%cl, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, lhs_bytes));
 
                     return lhs_bytes;
                 }
@@ -426,22 +520,31 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
-                    fprintf(codegen->out, "    shr %%cl, %s\n", get_reg_for(REG_ACCUMULATOR, lhs_bytes));
+                    fprintf(codegen->out,
+                            "    shr %%cl, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, lhs_bytes));
 
                     return lhs_bytes;
                 }
                 case AST_BINOP_BITWISE_XOR: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -453,13 +556,18 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                 }
                 case AST_BINOP_BITWISE_AND: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -471,13 +579,18 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                 }
                 case AST_BINOP_BITWISE_OR: {
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
                     fprintf(codegen->out, "    push %%rax\n");
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
 
-                    size_in_bytes_t expr_bytes = bytes_max(rhs_bytes, lhs_bytes);
+                    size_in_bytes_t expr_bytes =
+                        bytes_max(rhs_bytes, lhs_bytes);
 
                     fprintf(codegen->out, "    pop %%rcx\n");
                     fprintf(codegen->out,
@@ -488,16 +601,25 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                     return expr_bytes;
                 }
                 case AST_BINOP_LOGICAL_AND: {
-                    size_t label_exit = codegen_linux_x86_64_get_next_label(codegen);
+                    size_t label_exit =
+                        codegen_linux_x86_64_get_next_label(codegen);
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
-                    fprintf(codegen->out, "    cmp $0, %s\n", get_reg_for(REG_ACCUMULATOR, lhs_bytes));
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
+                    fprintf(codegen->out,
+                            "    cmp $0, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, lhs_bytes));
                     fprintf(codegen->out, "    je .L%ld\n", label_exit);
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
-                    fprintf(codegen->out, "    cmp $0, %s\n", get_reg_for(REG_ACCUMULATOR, rhs_bytes));
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
+                    fprintf(codegen->out,
+                            "    cmp $0, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, rhs_bytes));
                     fprintf(codegen->out, "    je .L%ld\n", label_exit);
                     fprintf(codegen->out, "    mov $1, %%rax\n");
                     fprintf(codegen->out, ".L%ld:\n", label_exit);
@@ -505,17 +627,27 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                     return 1;
                 }
                 case AST_BINOP_LOGICAL_OR: {
-                    size_t label_t = codegen_linux_x86_64_get_next_label(codegen);
-                    size_t label_f = codegen_linux_x86_64_get_next_label(codegen);
+                    size_t label_t =
+                        codegen_linux_x86_64_get_next_label(codegen);
+                    size_t label_f =
+                        codegen_linux_x86_64_get_next_label(codegen);
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t lhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.lhs);
-                    fprintf(codegen->out, "    cmp $0, %s\n", get_reg_for(REG_ACCUMULATOR, lhs_bytes));
+                    size_in_bytes_t lhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.lhs);
+                    fprintf(codegen->out,
+                            "    cmp $0, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, lhs_bytes));
                     fprintf(codegen->out, "    jne .L%ld\n", label_t);
 
                     fprintf(codegen->out, "    xor %%rax, %%rax\n");
-                    size_in_bytes_t rhs_bytes = codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
-                    fprintf(codegen->out, "    cmp $0, %s\n", get_reg_for(REG_ACCUMULATOR, rhs_bytes));
+                    size_in_bytes_t rhs_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             bin_op.rhs);
+                    fprintf(codegen->out,
+                            "    cmp $0, %s\n",
+                            get_reg_for(REG_ACCUMULATOR, rhs_bytes));
                     fprintf(codegen->out, "    je .L%ld\n", label_f);
 
                     fprintf(codegen->out, ".L%ld:\n", label_t);
@@ -532,12 +664,16 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
                     symbol_t *symbol = scope_lookup(scope, ref.id);
                     assert(symbol);
 
-                    size_t offset = codegen_linux_x86_64_get_stack_offset(codegen, symbol);
+                    size_t offset =
+                        codegen_linux_x86_64_get_stack_offset(codegen, symbol);
 
                     codegen_linux_x86_64_emit_expression(codegen, bin_op.rhs);
 
                     size_t type_size = type_to_bytes(symbol->type);
-                    fprintf(codegen->out, "    mov %s, -%ld(%%rbp)\n", get_reg_for(REG_ACCUMULATOR, type_size), offset);
+                    fprintf(codegen->out,
+                            "    mov %s, -%ld(%%rbp)\n",
+                            get_reg_for(REG_ACCUMULATOR, type_size),
+                            offset);
 
                     // FIXME: we don't support a = b = c
                     return 0;
@@ -553,9 +689,13 @@ codegen_linux_x86_64_emit_expression(codegen_x86_64_t *codegen, ast_node_t *expr
             ast_unary_op_t unary_op = expr_node->as_unary_op;
             switch (unary_op.kind) {
                 case AST_UNARY_BITWISE_NOT: {
-                    size_in_bytes_t expr_bytes = codegen_linux_x86_64_emit_expression(codegen, unary_op.expr);
+                    size_in_bytes_t expr_bytes =
+                        codegen_linux_x86_64_emit_expression(codegen,
+                                                             unary_op.expr);
 
-                    fprintf(codegen->out, "    not %s\n", get_reg_for(REG_ACCUMULATOR, expr_bytes));
+                    fprintf(codegen->out,
+                            "    not %s\n",
+                            get_reg_for(REG_ACCUMULATOR, expr_bytes));
 
                     return expr_bytes;
                 }
@@ -600,10 +740,12 @@ codegen_linux_x86_64_emit_block(codegen_x86_64_t *codegen, ast_block_t *block)
                 symbol_t *symbol = scope_lookup(scope, var_def.id);
                 assert(symbol);
 
-                codegen_linux_x86_64_put_stack_offset(codegen, symbol, codegen->base_offset);
+                codegen_linux_x86_64_put_stack_offset(
+                    codegen, symbol, codegen->base_offset);
 
                 if (var_def.value) {
-                    codegen_linux_x86_64_emit_expression(codegen, var_def.value);
+                    codegen_linux_x86_64_emit_expression(codegen,
+                                                         var_def.value);
                 }
 
                 size_t type_size = type_to_bytes(symbol->type);
@@ -633,7 +775,8 @@ codegen_linux_x86_64_emit_block(codegen_x86_64_t *codegen, ast_block_t *block)
                 ast_node_t *cond = while_stmt.cond;
                 ast_node_t *then = while_stmt.then;
 
-                size_t begin_label = codegen_linux_x86_64_get_next_label(codegen);
+                size_t begin_label =
+                    codegen_linux_x86_64_get_next_label(codegen);
                 size_t end_label = codegen_linux_x86_64_get_next_label(codegen);
 
                 fprintf(codegen->out, ".L%ld:\n", begin_label);
@@ -641,7 +784,8 @@ codegen_linux_x86_64_emit_block(codegen_x86_64_t *codegen, ast_block_t *block)
                 fprintf(codegen->out, "    cmp $1, %%rax\n");
                 fprintf(codegen->out, "    jnz .L%ld\n", end_label);
 
-                assert(then->kind == AST_NODE_BLOCK && "invalid while-then block");
+                assert(then->kind == AST_NODE_BLOCK &&
+                       "invalid while-then block");
                 ast_block_t then_block = then->as_block;
 
                 codegen_linux_x86_64_emit_block(codegen, &then_block);
@@ -652,7 +796,8 @@ codegen_linux_x86_64_emit_block(codegen_x86_64_t *codegen, ast_block_t *block)
                 break;
             }
             default: {
-                // FIXME: improve error: replace the node->kind to a string representation
+                // FIXME: improve error: replace the node->kind to a string
+                // representation
                 fprintf(stderr, "node kind %d not supported\n", node->kind);
                 assert(0 && "unsupported block statement");
                 break;
@@ -709,7 +854,8 @@ type_to_bytes(type_t *type)
             return 8;
         }
         case TYPE_UNKNOWN: {
-            assert(0 && "cannot calculate size of an unknown type: probably a parser issue.");
+            assert(0 && "cannot calculate size of an unknown type: probably a "
+                        "parser issue.");
         }
     }
 
@@ -739,7 +885,8 @@ calculate_fn_local_size(scope_t *scope)
     list_item_t *item = list_head(scope->children);
 
     while (item != NULL) {
-        size_t child_local_size = calculate_fn_local_size((scope_t *)item->value);
+        size_t child_local_size =
+            calculate_fn_local_size((scope_t *)item->value);
 
         if (child_local_size > max_child_local_size) {
             max_child_local_size = child_local_size;
@@ -752,7 +899,8 @@ calculate_fn_local_size(scope_t *scope)
 }
 
 static void
-codegen_linux_x86_64_emit_function(codegen_x86_64_t *codegen, ast_fn_definition_t *fn_def)
+codegen_linux_x86_64_emit_function(codegen_x86_64_t *codegen,
+                                   ast_fn_definition_t *fn_def)
 {
     codegen->base_offset = X86_CALL_EIP_STACK_OFFSET;
 
@@ -763,7 +911,8 @@ codegen_linux_x86_64_emit_function(codegen_x86_64_t *codegen, ast_fn_definition_
     fprintf(codegen->out, "    mov %%rsp, %%rbp\n");
 
     size_t i = 0;
-    for (list_item_t *item = list_head(fn_def->params); item != NULL; item = list_next(item)) {
+    for (list_item_t *item = list_head(fn_def->params); item != NULL;
+         item = list_next(item)) {
         assert(i < X86_CALL_ARG_SIZE);
 
         ast_fn_param_t *param = item->value;
@@ -773,7 +922,8 @@ codegen_linux_x86_64_emit_function(codegen_x86_64_t *codegen, ast_fn_definition_
 
         size_t offset = codegen->base_offset;
 
-        codegen_linux_x86_64_put_stack_offset(codegen, symbol, codegen->base_offset);
+        codegen_linux_x86_64_put_stack_offset(
+            codegen, symbol, codegen->base_offset);
 
         fprintf(codegen->out,
                 "    mov %s, -%ld(%%rbp)\n",
@@ -799,7 +949,9 @@ codegen_linux_x86_64_emit_function(codegen_x86_64_t *codegen, ast_fn_definition_
 }
 
 static void
-codegen_linux_x86_64_put_stack_offset(codegen_x86_64_t *codegen, symbol_t *symbol, size_t offset)
+codegen_linux_x86_64_put_stack_offset(codegen_x86_64_t *codegen,
+                                      symbol_t *symbol,
+                                      size_t offset)
 {
 
     size_t *stack_offset = arena_alloc(codegen->arena, sizeof(size_t));
@@ -812,7 +964,8 @@ codegen_linux_x86_64_put_stack_offset(codegen_x86_64_t *codegen, symbol_t *symbo
 }
 
 static size_t
-codegen_linux_x86_64_get_stack_offset(codegen_x86_64_t *codegen, symbol_t *symbol)
+codegen_linux_x86_64_get_stack_offset(codegen_x86_64_t *codegen,
+                                      symbol_t *symbol)
 {
     char symbol_ptr[PTR_HEX_CSTR_SIZE];
     sprintf(symbol_ptr, "%lx", (uintptr_t)symbol);
diff --git a/src/codegen_linux_x86_64.h b/src/codegen_linux_x86_64.h
index a4137de..7e2841d 100644
--- a/src/codegen_linux_x86_64.h
+++ b/src/codegen_linux_x86_64.h
@@ -35,6 +35,7 @@ void
 codegen_linux_x86_64_init(codegen_x86_64_t *codegen, arena_t *arena, FILE *out);
 
 void
-codegen_linux_x86_64_emit_translation_unit(codegen_x86_64_t *codegen, ast_node_t *prog);
+codegen_linux_x86_64_emit_translation_unit(codegen_x86_64_t *codegen,
+                                           ast_node_t *prog);
 
 #endif /* CODEGEN_X86_64_H */
diff --git a/src/lexer.c b/src/lexer.c
index 03763de..1a6c24b 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -50,7 +50,10 @@ static void
 lexer_init_char_value_token(lexer_t *lexer, token_t *token, token_kind_t kind);
 
 static void
-lexer_init_str_value_token(lexer_t *lexer, token_t *token, token_kind_t kind, lexer_cursor_t cur);
+lexer_init_str_value_token(lexer_t *lexer,
+                           token_t *token,
+                           token_kind_t kind,
+                           lexer_cursor_t cur);
 
 static void
 lexer_init_eof_token(lexer_t *lexer, token_t *token);
@@ -95,7 +98,8 @@ lexer_next_token(lexer_t *lexer, token_t *token)
                 .size = lexer->cur.offset - start_cur.offset,
             };
 
-            lexer_init_str_value_token(lexer, token, lexer_str_to_token_kind(text), start_cur);
+            lexer_init_str_value_token(
+                lexer, token, lexer_str_to_token_kind(text), start_cur);
             return;
         }
 
@@ -117,7 +121,8 @@ lexer_next_token(lexer_t *lexer, token_t *token)
 
                 if (lexer_current_char(lexer) == '=') {
                     lexer_skip_char(lexer);
-                    lexer_init_str_value_token(lexer, token, TOKEN_CMP_EQ, start_cur);
+                    lexer_init_str_value_token(
+                        lexer, token, TOKEN_CMP_EQ, start_cur);
                     return;
                 }
 
@@ -130,7 +135,8 @@ lexer_next_token(lexer_t *lexer, token_t *token)
 
                 if (lexer_current_char(lexer) == '=') {
                     lexer_skip_char(lexer);
-                    lexer_init_str_value_token(lexer, token, TOKEN_CMP_NEQ, start_cur);
+                    lexer_init_str_value_token(
+                        lexer, token, TOKEN_CMP_NEQ, start_cur);
                     return;
                 }
 
@@ -143,7 +149,8 @@ lexer_next_token(lexer_t *lexer, token_t *token)
 
                 if (lexer_current_char(lexer) == '&') {
                     lexer_skip_char(lexer);
-                    lexer_init_str_value_token(lexer, token, TOKEN_LOGICAL_AND, start_cur);
+                    lexer_init_str_value_token(
+                        lexer, token, TOKEN_LOGICAL_AND, start_cur);
                     return;
                 }
 
@@ -156,7 +163,8 @@ lexer_next_token(lexer_t *lexer, token_t *token)
 
                 if (lexer_current_char(lexer) == '|') {
                     lexer_skip_char(lexer);
-                    lexer_init_str_value_token(lexer, token, TOKEN_LOGICAL_OR, start_cur);
+                    lexer_init_str_value_token(
+                        lexer, token, TOKEN_LOGICAL_OR, start_cur);
                     return;
                 }
 
@@ -170,16 +178,19 @@ lexer_next_token(lexer_t *lexer, token_t *token)
                 switch (lexer_current_char(lexer)) {
                     case '<': {
                         lexer_skip_char(lexer);
-                        lexer_init_str_value_token(lexer, token, TOKEN_BITWISE_LSHIFT, start_cur);
+                        lexer_init_str_value_token(
+                            lexer, token, TOKEN_BITWISE_LSHIFT, start_cur);
                         return;
                     }
                     case '=': {
                         lexer_skip_char(lexer);
-                        lexer_init_str_value_token(lexer, token, TOKEN_CMP_LEQ, start_cur);
+                        lexer_init_str_value_token(
+                            lexer, token, TOKEN_CMP_LEQ, start_cur);
                         return;
                     }
                     default: {
-                        lexer_init_str_value_token(lexer, token, TOKEN_LT, start_cur);
+                        lexer_init_str_value_token(
+                            lexer, token, TOKEN_LT, start_cur);
                         return;
                     }
                 }
@@ -191,16 +202,19 @@ lexer_next_token(lexer_t *lexer, token_t *token)
                 switch (lexer_current_char(lexer)) {
                     case '>': {
                         lexer_skip_char(lexer);
-                        lexer_init_str_value_token(lexer, token, TOKEN_BITWISE_RSHIFT, start_cur);
+                        lexer_init_str_value_token(
+                            lexer, token, TOKEN_BITWISE_RSHIFT, start_cur);
                         return;
                     }
                     case '=': {
                         lexer_skip_char(lexer);
-                        lexer_init_str_value_token(lexer, token, TOKEN_CMP_GEQ, start_cur);
+                        lexer_init_str_value_token(
+                            lexer, token, TOKEN_CMP_GEQ, start_cur);
                         return;
                     }
                     default: {
-                        lexer_init_str_value_token(lexer, token, TOKEN_GT, start_cur);
+                        lexer_init_str_value_token(
+                            lexer, token, TOKEN_GT, start_cur);
                         return;
                     }
                 }
@@ -421,7 +435,10 @@ lexer_init_char_value_token(lexer_t *lexer, token_t *token, token_kind_t kind)
 }
 
 static void
-lexer_init_str_value_token(lexer_t *lexer, token_t *token, token_kind_t kind, lexer_cursor_t cur)
+lexer_init_str_value_token(lexer_t *lexer,
+                           token_t *token,
+                           token_kind_t kind,
+                           lexer_cursor_t cur)
 {
     string_view_t str = {
         .chars = lexer->src.code.chars + cur.offset,
@@ -510,7 +527,8 @@ token_loc_to_line(token_loc_t loc)
         .size = 0,
     };
 
-    while ((line.size + offset) < loc.src.code.size && line.chars[line.size] != '\n' && line.chars[line.size] != 0) {
+    while ((line.size + offset) < loc.src.code.size &&
+           line.chars[line.size] != '\n' && line.chars[line.size] != 0) {
         ++line.size;
     }
 
diff --git a/src/main.c b/src/main.c
index aa09f34..2b02564 100644
--- a/src/main.c
+++ b/src/main.c
@@ -158,7 +158,8 @@ handle_codegen_linux(cli_opts_t *opts)
         } else if (strcmp(opts->arch, "aarch64") == 0) {
             codegen_linux_aarch64_emit_translation_unit(out, ast);
         } else {
-            fprintf(stderr, "error: architecture '%s' not supported\n", opts->arch);
+            fprintf(
+                stderr, "error: architecture '%s' not supported\n", opts->arch);
             cli_print_usage(stderr, opts->compiler_path);
             exit(EXIT_FAILURE);
         }
@@ -171,7 +172,11 @@ handle_codegen_linux(cli_opts_t *opts)
     }
 
     char command[512];
-    sprintf(command, "%s/bin/as %s -o " SV_FMT ".o", opts->sysroot, asm_file, SV_ARG(opts->output_bin));
+    sprintf(command,
+            "%s/bin/as %s -o " SV_FMT ".o",
+            opts->sysroot,
+            asm_file,
+            SV_ARG(opts->output_bin));
 
     int exit_code = system(command);
 
@@ -210,7 +215,10 @@ read_entire_file(char *filepath, arena_t *arena)
     FILE *stream = fopen(filepath, "rb");
 
     if (stream == NULL) {
-        fprintf(stderr, "error: could not open file %s: %s\n", filepath, strerror(errno));
+        fprintf(stderr,
+                "error: could not open file %s: %s\n",
+                filepath,
+                strerror(errno));
         exit(EXIT_FAILURE);
     }
 
@@ -225,7 +233,10 @@ read_entire_file(char *filepath, arena_t *arena)
     code.chars = (char *)arena_alloc(arena, (size_t)code.size);
 
     if (code.chars == NULL) {
-        fprintf(stderr, "error: could not read file %s: %s\n", filepath, strerror(errno));
+        fprintf(stderr,
+                "error: could not read file %s: %s\n",
+                filepath,
+                strerror(errno));
         exit(EXIT_FAILURE);
     }
 
diff --git a/src/map.c b/src/map.c
index 42801b0..97db39e 100644
--- a/src/map.c
+++ b/src/map.c
@@ -42,7 +42,8 @@ map_new(arena_t *arena)
 {
     map_t *map = (map_t *)arena_alloc(arena, sizeof(map_t));
     if (map == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: map_new: %s\n", strerror(errno));
+        fprintf(
+            stderr, "[FATAL] Out of memory: map_new: %s\n", strerror(errno));
         exit(EXIT_FAILURE);
     }
     map->arena = arena;
@@ -54,11 +55,13 @@ static void
 map_init(map_t *map)
 {
     assert(map);
-    map->entries = (map_entry_t *)arena_alloc(map->arena, MAP_INITIAL_CAPACITY * sizeof(map_entry_t));
+    map->entries = (map_entry_t *)arena_alloc(
+        map->arena, MAP_INITIAL_CAPACITY * sizeof(map_entry_t));
     assert(map->entries != NULL);
     memset(map->entries, 0, MAP_INITIAL_CAPACITY * sizeof(map_entry_t));
     if (map->entries == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: map_init: %s\n", strerror(errno));
+        fprintf(
+            stderr, "[FATAL] Out of memory: map_init: %s\n", strerror(errno));
         exit(EXIT_FAILURE);
     }
     map->capacity = MAP_INITIAL_CAPACITY;
@@ -101,7 +104,8 @@ map_put(map_t *map, char *key, void *value)
             break;
         }
         if (entry->next == NULL) {
-            entry->next = (map_entry_t *)arena_alloc(map->arena, sizeof(map_entry_t));
+            entry->next =
+                (map_entry_t *)arena_alloc(map->arena, sizeof(map_entry_t));
             *entry->next = (map_entry_t){
                 .key = _strdup(key, map->arena),
                 .hash = hash,
diff --git a/src/parser.c b/src/parser.c
index 177195d..4282f0a 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -150,7 +150,10 @@ token_kind_to_binary_op_kind(token_kind_t kind)
         case TOKEN_EQ:
             return AST_BINOP_ASSIGN;
         default: {
-            fprintf(stderr, "error: token kind (%s) not compatible with binary op kind\n", token_kind_to_cstr(kind));
+            fprintf(
+                stderr,
+                "error: token kind (%s) not compatible with binary op kind\n",
+                token_kind_to_cstr(kind));
             assert(false);
         }
     }
@@ -228,7 +231,8 @@ token_kind_to_unary_op_kind(token_kind_t token_kind)
         case TOKEN_BANG:
             return AST_UNARY_LOGICAL_NOT;
         default:
-            assert(false && "unable to covert the token_kind_t to unary_op_kind_t");
+            assert(false &&
+                   "unable to covert the token_kind_t to unary_op_kind_t");
     }
 }
 
@@ -251,12 +255,18 @@ parser_parse_expr_1(parser_t *parser, ast_node_t *lhs, size_t prev_precedence)
         lexer_peek_next(parser->lexer, &lookahead_token);
 
         while (token_kind_is_binary_op(lookahead_token.kind) &&
-               get_binary_op_precedence(lookahead_token.kind) > get_binary_op_precedence(token_op.kind)) {
-            rhs = parser_parse_expr_1(parser, rhs, get_binary_op_precedence(token_op.kind));
+               get_binary_op_precedence(lookahead_token.kind) >
+                   get_binary_op_precedence(token_op.kind)) {
+            rhs = parser_parse_expr_1(
+                parser, rhs, get_binary_op_precedence(token_op.kind));
             lexer_peek_next(parser->lexer, &lookahead_token);
         }
 
-        lhs = ast_new_node_bin_op(parser->arena, token_op.loc, token_kind_to_binary_op_kind(token_op.kind), lhs, rhs);
+        lhs = ast_new_node_bin_op(parser->arena,
+                                  token_op.loc,
+                                  token_kind_to_binary_op_kind(token_op.kind),
+                                  lhs,
+                                  rhs);
         if (lhs == NULL) {
             return NULL;
         }
@@ -284,7 +294,8 @@ parser_parse_factor(parser_t *parser)
 
     switch (token.kind) {
         case TOKEN_NUMBER:
-            return ast_new_node_literal_u32(parser->arena, token.loc, string_view_to_u32(token.value));
+            return ast_new_node_literal_u32(
+                parser->arena, token.loc, string_view_to_u32(token.value));
 
         case TOKEN_ID: {
             token_t token_id = token;
@@ -293,9 +304,11 @@ parser_parse_factor(parser_t *parser)
 
             if (token.kind == TOKEN_OPAREN) {
                 list_t *args = parser_parse_fn_args(parser);
-                return ast_new_node_fn_call(parser->arena, token_id.loc, token_id.value, args);
+                return ast_new_node_fn_call(
+                    parser->arena, token_id.loc, token_id.value, args);
             }
-            return ast_new_node_ref(parser->arena, token_id.loc, token_id.value);
+            return ast_new_node_ref(
+                parser->arena, token_id.loc, token_id.value);
         }
         case TOKEN_AND:
         case TOKEN_STAR:
@@ -325,7 +338,9 @@ parser_parse_factor(parser_t *parser)
             return expr;
         }
         default: {
-            fprintf(stderr, "error: parse_factor: unsupported or invalid token (%s)\n", token_kind_to_cstr(token.kind));
+            fprintf(stderr,
+                    "error: parse_factor: unsupported or invalid token (%s)\n",
+                    token_kind_to_cstr(token.kind));
             assert(false);
         }
     }
@@ -340,7 +355,9 @@ parser_parse_fn_args(parser_t *parser)
 
     list_t *args = arena_alloc(parser->arena, sizeof(list_t));
     if (args == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: parser_parse_fn_args: %s\n", strerror(errno));
+        fprintf(stderr,
+                "[FATAL] Out of memory: parser_parse_fn_args: %s\n",
+                strerror(errno));
         exit(EXIT_FAILURE);
     }
 
@@ -382,7 +399,9 @@ parser_parse_fn_params(parser_t *parser)
 
     list_t *params = arena_alloc(parser->arena, sizeof(list_t));
     if (params == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: parser_parse_fn_params: %s\n", strerror(errno));
+        fprintf(stderr,
+                "[FATAL] Out of memory: parser_parse_fn_params: %s\n",
+                strerror(errno));
         exit(EXIT_FAILURE);
     }
 
@@ -410,7 +429,8 @@ parser_parse_fn_params(parser_t *parser)
             return NULL;
         }
 
-        ast_fn_param_t *param = ast_new_fn_param(parser->arena, token.value, type);
+        ast_fn_param_t *param =
+            ast_new_fn_param(parser->arena, token.value, type);
         list_append(params, param);
 
         skip_line_feeds(parser->lexer);
@@ -460,7 +480,12 @@ parser_parse_fn_definition(parser_t *parser)
         return NULL;
     }
 
-    return ast_new_node_fn_def(parser->arena, fn_name_token.loc, fn_name_token.value, params, ret_type, block);
+    return ast_new_node_fn_def(parser->arena,
+                               fn_name_token.loc,
+                               fn_name_token.value,
+                               params,
+                               ret_type,
+                               block);
 }
 
 static type_t *
@@ -492,7 +517,8 @@ parser_parse_type(parser_t *parser)
         }
         string_view_t ptr_id = token.value;
 
-        ptr_id.size = ptr_token.value.chars - token.value.chars + ptr_token.value.size;
+        ptr_id.size =
+            ptr_token.value.chars - token.value.chars + ptr_token.value.size;
 
         return type_new_ptr(parser->arena, ptr_id, type);
     }
@@ -581,7 +607,8 @@ parser_parse_return_stmt(parser_t *parser)
         return NULL;
     }
 
-    ast_node_t *node_return_stmt = ast_new_node_return_stmt(parser->arena, token_ret.loc, expr);
+    ast_node_t *node_return_stmt =
+        ast_new_node_return_stmt(parser->arena, token_ret.loc, expr);
     assert(node_return_stmt);
 
     return node_return_stmt;
@@ -632,7 +659,8 @@ parser_parse_if_stmt(parser_t *parser)
         }
     }
 
-    ast_node_t *node_if_stmt = ast_new_node_if_stmt(parser->arena, token_if.loc, cond, then, _else);
+    ast_node_t *node_if_stmt =
+        ast_new_node_if_stmt(parser->arena, token_if.loc, cond, then, _else);
 
     assert(node_if_stmt);
 
@@ -664,7 +692,8 @@ parser_parse_while_stmt(parser_t *parser)
     token_t next_token;
     peek_next_non_lf_token(parser->lexer, &next_token);
 
-    ast_node_t *node_while_stmt = ast_new_node_while_stmt(parser->arena, token_while.loc, cond, then);
+    ast_node_t *node_while_stmt =
+        ast_new_node_while_stmt(parser->arena, token_while.loc, cond, then);
 
     assert(node_while_stmt);
 
@@ -698,7 +727,8 @@ parser_parse_var_def(parser_t *parser)
         return NULL;
     }
 
-    ast_node_t *var_node = ast_new_node_var_def(parser->arena, token_id.loc, token_id.value, type, expr);
+    ast_node_t *var_node = ast_new_node_var_def(
+        parser->arena, token_id.loc, token_id.value, type, expr);
 
     return var_node;
 }
@@ -711,7 +741,9 @@ skip_expected_token(parser_t *parser, token_kind_t expected_kind)
 }
 
 static bool
-expected_next_token(parser_t *parser, token_t *token, token_kind_t expected_kind)
+expected_next_token(parser_t *parser,
+                    token_t *token,
+                    token_kind_t expected_kind)
 {
     lexer_next_token(parser->lexer, token);
     return expected_token(token, expected_kind);
@@ -722,7 +754,8 @@ expected_token(token_t *token, token_kind_t expected_kind)
 {
     if (token->kind != expected_kind) {
         fprintf(stderr,
-                "%s:%lu:%lu: syntax error: got '" SV_FMT "' token but expect '%s'\n",
+                "%s:%lu:%lu: syntax error: got '" SV_FMT
+                "' token but expect '%s'\n",
                 token->loc.src.filepath,
                 token_loc_to_lineno(token->loc),
                 token_loc_to_colno(token->loc),
diff --git a/src/pretty_print_ast.c b/src/pretty_print_ast.c
index 387cde4..d2164eb 100644
--- a/src/pretty_print_ast.c
+++ b/src/pretty_print_ast.c
@@ -80,7 +80,10 @@ pretty_print_print_ident(uint64_t *prefix, size_t level, bool lst_children)
 }
 
 static void
-pretty_print_tree(pretty_print_node_t *node, uint64_t *prefix, size_t level, bool lst_children)
+pretty_print_tree(pretty_print_node_t *node,
+                  uint64_t *prefix,
+                  size_t level,
+                  bool lst_children)
 {
     pretty_print_print_ident(prefix, level, lst_children);
 
@@ -94,7 +97,8 @@ pretty_print_tree(pretty_print_node_t *node, uint64_t *prefix, size_t level, boo
 
     size_t size = list_size(list);
     for (size_t i = 0; i < size; ++i) {
-        pretty_print_node_t *it = (pretty_print_node_t *)list_get(list, i)->value;
+        pretty_print_node_t *it =
+            (pretty_print_node_t *)list_get(list, i)->value;
         pretty_print_tree(it, prefix, level + 1, i + 1 == size);
     }
 }
@@ -102,7 +106,8 @@ pretty_print_tree(pretty_print_node_t *node, uint64_t *prefix, size_t level, boo
 static pretty_print_node_t *
 pretty_print_node_new(arena_t *arena)
 {
-    pretty_print_node_t *node = (pretty_print_node_t *)arena_alloc(arena, sizeof(pretty_print_node_t));
+    pretty_print_node_t *node =
+        (pretty_print_node_t *)arena_alloc(arena, sizeof(pretty_print_node_t));
     node->children = (list_t *)arena_alloc(arena, sizeof(list_t));
     list_init(node->children, arena);
     return node;
@@ -113,7 +118,10 @@ pretty_print_new_fn_param(ast_fn_param_t *param, arena_t *arena)
 {
     pretty_print_node_t *node = pretty_print_node_new(arena);
     char name[256];
-    sprintf(name, "Param_Definition <name:" SV_FMT "> <type:" SV_FMT ">", SV_ARG(param->id), SV_ARG(param->type->id));
+    sprintf(name,
+            "Param_Definition <name:" SV_FMT "> <type:" SV_FMT ">",
+            SV_ARG(param->id),
+            SV_ARG(param->type->id));
     node->name = (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
     strcpy(node->name, name);
     return node;
@@ -132,7 +140,8 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
             while (item != NULL) {
                 ast_node_t *decl = (ast_node_t *)item->value;
 
-                pretty_print_node_t *fn_node = ast_node_to_pretty_print_node(decl, arena);
+                pretty_print_node_t *fn_node =
+                    ast_node_to_pretty_print_node(decl, arena);
                 list_append(node->children, fn_node);
 
                 item = list_next(item);
@@ -149,16 +158,19 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
                     "Function_Definition <name:" SV_FMT "> <return:" SV_FMT ">",
                     SV_ARG(fn_def.id),
                     SV_ARG(fn_def.return_type->id));
-            node->name = (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
+            node->name =
+                (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
             strcpy(node->name, name);
 
             list_item_t *param = list_head(fn_def.params);
             while (param != NULL) {
-                list_append(node->children, pretty_print_new_fn_param(param->value, arena));
+                list_append(node->children,
+                            pretty_print_new_fn_param(param->value, arena));
                 param = list_next(param);
             }
 
-            pretty_print_node_t *block = ast_node_to_pretty_print_node(fn_def.block, arena);
+            pretty_print_node_t *block =
+                ast_node_to_pretty_print_node(fn_def.block, arena);
             list_append(node->children, block);
             return node;
         }
@@ -167,13 +179,16 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
             ast_fn_call_t fn_call = ast->as_fn_call;
 
             char name[256];
-            sprintf(name, "Function_Call <name:" SV_FMT ">", SV_ARG(fn_call.id));
-            node->name = (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
+            sprintf(
+                name, "Function_Call <name:" SV_FMT ">", SV_ARG(fn_call.id));
+            node->name =
+                (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
             strcpy(node->name, name);
 
             list_item_t *item = list_head(fn_call.args);
             while (item != NULL) {
-                list_append(node->children, ast_node_to_pretty_print_node(item->value, arena));
+                list_append(node->children,
+                            ast_node_to_pretty_print_node(item->value, arena));
                 item = list_next(item);
             }
 
@@ -187,8 +202,10 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
 
             size_t block_nodes_size = list_size(block.nodes);
             for (size_t i = 0; i < block_nodes_size; ++i) {
-                ast_node_t *ast_node = (ast_node_t *)list_get(block.nodes, i)->value;
-                pretty_print_node_t *child = ast_node_to_pretty_print_node(ast_node, arena);
+                ast_node_t *ast_node =
+                    (ast_node_t *)list_get(block.nodes, i)->value;
+                pretty_print_node_t *child =
+                    ast_node_to_pretty_print_node(ast_node, arena);
                 list_append(node->children, child);
             }
             return node;
@@ -199,7 +216,8 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
 
             node->name = "Return_Statement";
 
-            pretty_print_node_t *child = ast_node_to_pretty_print_node(return_stmt.expr, arena);
+            pretty_print_node_t *child =
+                ast_node_to_pretty_print_node(return_stmt.expr, arena);
             list_append(node->children, child);
 
             return node;
@@ -210,7 +228,8 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
 
             node->name = "If_Statement";
 
-            pretty_print_node_t *child = ast_node_to_pretty_print_node(if_stmt.cond, arena);
+            pretty_print_node_t *child =
+                ast_node_to_pretty_print_node(if_stmt.cond, arena);
             list_append(node->children, child);
 
             child = ast_node_to_pretty_print_node(if_stmt.then, arena);
@@ -229,7 +248,8 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
 
             node->name = "While_Statement";
 
-            pretty_print_node_t *child = ast_node_to_pretty_print_node(while_stmt.cond, arena);
+            pretty_print_node_t *child =
+                ast_node_to_pretty_print_node(while_stmt.cond, arena);
             list_append(node->children, child);
 
             child = ast_node_to_pretty_print_node(while_stmt.then, arena);
@@ -244,8 +264,10 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
             char name[256];
             switch (literal.kind) {
                 case AST_LITERAL_U32: {
-                    sprintf(name, "Literal <kind:u32> <value:%u>", literal.as_u32);
-                    node->name = (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
+                    sprintf(
+                        name, "Literal <kind:u32> <value:%u>", literal.as_u32);
+                    node->name = (char *)arena_alloc(
+                        arena, sizeof(char) * (strlen(name) + 1));
                     strcpy(node->name, name);
                     break;
                 }
@@ -260,11 +282,16 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
             ast_var_definition_t var = ast->as_var_def;
 
             char name[256];
-            sprintf(name, "Var_Definition <name:" SV_FMT "> <kind:" SV_FMT ">", SV_ARG(var.id), SV_ARG(var.type->id));
-            node->name = (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
+            sprintf(name,
+                    "Var_Definition <name:" SV_FMT "> <kind:" SV_FMT ">",
+                    SV_ARG(var.id),
+                    SV_ARG(var.type->id));
+            node->name =
+                (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
             strcpy(node->name, name);
 
-            pretty_print_node_t *child = ast_node_to_pretty_print_node(var.value, arena);
+            pretty_print_node_t *child =
+                ast_node_to_pretty_print_node(var.value, arena);
             list_append(node->children, child);
 
             return node;
@@ -275,7 +302,8 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
 
             char name[256];
             sprintf(name, "Reference <name:" SV_FMT ">", SV_ARG(ref.id));
-            node->name = (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
+            node->name =
+                (char *)arena_alloc(arena, sizeof(char) * (strlen(name) + 1));
             strcpy(node->name, name);
 
             return node;
@@ -365,8 +393,10 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
                     assert(false && "binop not implemented");
             }
 
-            pretty_print_node_t *lhs = ast_node_to_pretty_print_node(binop.lhs, arena);
-            pretty_print_node_t *rhs = ast_node_to_pretty_print_node(binop.rhs, arena);
+            pretty_print_node_t *lhs =
+                ast_node_to_pretty_print_node(binop.lhs, arena);
+            pretty_print_node_t *rhs =
+                ast_node_to_pretty_print_node(binop.rhs, arena);
 
             list_append(node->children, lhs);
             list_append(node->children, rhs);
@@ -405,7 +435,8 @@ ast_node_to_pretty_print_node(ast_node_t *ast, arena_t *arena)
                 }
             }
 
-            pretty_print_node_t *expr = ast_node_to_pretty_print_node(unary_op.expr, arena);
+            pretty_print_node_t *expr =
+                ast_node_to_pretty_print_node(unary_op.expr, arena);
             list_append(node->children, expr);
 
             return node;
diff --git a/src/scope.c b/src/scope.c
index e483fbe..274982f 100644
--- a/src/scope.c
+++ b/src/scope.c
@@ -28,7 +28,8 @@ scope_new(arena_t *arena)
     assert(arena);
     scope_t *scope = (scope_t *)arena_alloc(arena, sizeof(scope_t));
     if (scope == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: scope_new: %s\n", strerror(errno));
+        fprintf(
+            stderr, "[FATAL] Out of memory: scope_new: %s\n", strerror(errno));
         exit(EXIT_FAILURE);
     }
     scope->arena = arena;
@@ -38,7 +39,8 @@ scope_new(arena_t *arena)
     list_t *children = (list_t *)arena_alloc(arena, sizeof(list_t));
 
     if (children == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: scope_new: %s\n", strerror(errno));
+        fprintf(
+            stderr, "[FATAL] Out of memory: scope_new: %s\n", strerror(errno));
         exit(EXIT_FAILURE);
     }
 
@@ -54,7 +56,8 @@ symbol_new(arena_t *arena, string_view_t id, type_t *type)
     assert(arena);
     symbol_t *symbol = (symbol_t *)arena_alloc(arena, sizeof(symbol_t));
     if (symbol == NULL) {
-        fprintf(stderr, "[FATAL] Out of memory: symbol_new: %s\n", strerror(errno));
+        fprintf(
+            stderr, "[FATAL] Out of memory: symbol_new: %s\n", strerror(errno));
         exit(EXIT_FAILURE);
     }
     symbol->id = id;
diff --git a/tests/unit/arena_test.c b/tests/unit/arena_test.c
index a471572..1c16492 100644
--- a/tests/unit/arena_test.c
+++ b/tests/unit/arena_test.c
@@ -84,11 +84,27 @@ arena_padding_test(const MunitParameter params[], void *user_data_or_fixture)
     return MUNIT_OK;
 }
 
-static MunitTest tests[] = { { "/arena_alloc_test", arena_alloc_test, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
-                             { "/arena_padding_test", arena_padding_test, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
-                             { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL } };
-
-static const MunitSuite suite = { "/arena", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE };
+static MunitTest tests[] = {
+    { "/arena_alloc_test",
+      arena_alloc_test,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
+    { "/arena_padding_test",
+      arena_padding_test,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
+    { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
+};
+
+static const MunitSuite suite = { "/arena",
+                                  tests,
+                                  NULL,
+                                  1,
+                                  MUNIT_SUITE_OPTION_NONE };
 
 int
 main(int argc, char *argv[])
diff --git a/tests/unit/list_test.c b/tests/unit/list_test.c
index 8b759f9..72e7788 100644
--- a/tests/unit/list_test.c
+++ b/tests/unit/list_test.c
@@ -95,12 +95,33 @@ list_next_test(const MunitParameter params[], void *user_data_or_fixture)
     return MUNIT_OK;
 }
 
-static MunitTest tests[] = { { "/list_append_test", list_append_test, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
-                             { "/list_get_test", list_get_test, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
-                             { "/list_next_test", list_next_test, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
-                             { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL } };
-
-static const MunitSuite suite = { "/list", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE };
+static MunitTest tests[] = {
+    { "/list_append_test",
+      list_append_test,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
+    { "/list_get_test",
+      list_get_test,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
+    { "/list_next_test",
+      list_next_test,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
+    { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
+};
+
+static const MunitSuite suite = { "/list",
+                                  tests,
+                                  NULL,
+                                  1,
+                                  MUNIT_SUITE_OPTION_NONE };
 
 int
 main(int argc, char *argv[])
diff --git a/tests/unit/map_test.c b/tests/unit/map_test.c
index 9497c7c..2be431e 100644
--- a/tests/unit/map_test.c
+++ b/tests/unit/map_test.c
@@ -92,12 +92,26 @@ test_map_get_kvs(const MunitParameter params[], void *user_data_or_fixture)
 }
 
 static MunitTest tests[] = {
-    { "/test_create_new", test_create_new, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
-    { "/test_map_put_and_get", test_map_put_and_get, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
+    { "/test_create_new",
+      test_create_new,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
+    { "/test_map_put_and_get",
+      test_map_put_and_get,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
     { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
 };
 
-static const MunitSuite suite = { "/map", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE };
+static const MunitSuite suite = { "/map",
+                                  tests,
+                                  NULL,
+                                  1,
+                                  MUNIT_SUITE_OPTION_NONE };
 
 int
 main(int argc, char *argv[])
diff --git a/tests/unit/string_view_test.c b/tests/unit/string_view_test.c
index d85f19b..9600c77 100644
--- a/tests/unit/string_view_test.c
+++ b/tests/unit/string_view_test.c
@@ -22,7 +22,8 @@
 #include <string.h>
 
 static MunitResult
-string_view_eq_to_cstr_test(const MunitParameter params[], void *user_data_or_fixture)
+string_view_eq_to_cstr_test(const MunitParameter params[],
+                            void *user_data_or_fixture)
 {
     char *name = "John Doe";
 
@@ -46,7 +47,8 @@ string_view_eq_to_cstr_test(const MunitParameter params[], void *user_data_or_fi
 }
 
 static MunitResult
-string_view_to_u32_test(const MunitParameter params[], void *user_data_or_fixture)
+string_view_to_u32_test(const MunitParameter params[],
+                        void *user_data_or_fixture)
 {
     char *number = "69";
 
@@ -68,12 +70,26 @@ string_view_to_u32_test(const MunitParameter params[], void *user_data_or_fixtur
 }
 
 static MunitTest tests[] = {
-    { "/eq_to_cstr_test", string_view_eq_to_cstr_test, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
-    { "/to_u32_test", string_view_to_u32_test, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
+    { "/eq_to_cstr_test",
+      string_view_eq_to_cstr_test,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
+    { "/to_u32_test",
+      string_view_to_u32_test,
+      NULL,
+      NULL,
+      MUNIT_TEST_OPTION_NONE,
+      NULL },
     { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
 };
 
-static const MunitSuite suite = { "/string_view", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE };
+static const MunitSuite suite = { "/string_view",
+                                  tests,
+                                  NULL,
+                                  1,
+                                  MUNIT_SUITE_OPTION_NONE };
 
 int
 main(int argc, char *argv[])
-- 
2.46.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [olang/patches/.build.yml] build success
  2024-10-11 16:57 ` [PATCH olang v2 4/4] codestyle: limit the code to 80 characters Carlos Maniero
@ 2024-10-11 16:58   ` builds.sr.ht
  0 siblings, 0 replies; 7+ messages in thread
From: builds.sr.ht @ 2024-10-11 16:58 UTC (permalink / raw)
  To: Carlos Maniero; +Cc: ~johnnyrichard/olang-devel

olang/patches/.build.yml: SUCCESS in 30s

[codestyle: change our formater ][0] v2 from [Carlos Maniero][1]

[0]: https://lists.sr.ht/~johnnyrichard/olang-devel/patches/55439
[1]: mailto:carlos@maniero.me

✓ #1348905 SUCCESS olang/patches/.build.yml https://builds.sr.ht/~johnnyrichard/job/1348905

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH olang v2 0/4] codestyle: change our formater
  2024-10-11 16:57 [PATCH olang v2 0/4] codestyle: change our formater Carlos Maniero
                   ` (3 preceding siblings ...)
  2024-10-11 16:57 ` [PATCH olang v2 4/4] codestyle: limit the code to 80 characters Carlos Maniero
@ 2024-10-12 23:35 ` Johnny Richard
  4 siblings, 0 replies; 7+ messages in thread
From: Johnny Richard @ 2024-10-12 23:35 UTC (permalink / raw)
  To: Carlos Maniero; +Cc: ~johnnyrichard/olang-devel

Thanks. applied!

To git.sr.ht:~johnnyrichard/olang
   dae4440..0e12f26  main -> main


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-12 21:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-11 16:57 [PATCH olang v2 0/4] codestyle: change our formater Carlos Maniero
2024-10-11 16:57 ` [PATCH olang v2 1/4] codestyle: prevent extra empty lines at EOF Carlos Maniero
2024-10-11 16:57 ` [PATCH olang v2 2/4] codestyle: do not allow single line enums Carlos Maniero
2024-10-11 16:57 ` [PATCH olang v2 3/4] codestyle: add trailing comma on struct initializer Carlos Maniero
2024-10-11 16:57 ` [PATCH olang v2 4/4] codestyle: limit the code to 80 characters Carlos Maniero
2024-10-11 16:58   ` [olang/patches/.build.yml] build success builds.sr.ht
2024-10-12 23:35 ` [PATCH olang v2 0/4] codestyle: change our formater Johnny Richard

Code repositories for project(s) associated with this public inbox

	https://git.johnnyrichard.com/olang.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox