6703c40f482d455f46d2e018f61ab6cbbd0a6db5
Implement several interconnected features for function declarations: - noalias_bits: Track which parameters have the noalias keyword by setting corresponding bits in a uint32_t (supports up to 32 parameters) - is_var_args: Detect ellipsis3 (...) token in parameter list - is_noinline/has_inline_keyword: Detect noinline/inline modifiers - callconv handling: Extract callconv_expr from fn_proto variants, create cc_gz sub-block, emit builtin_value for explicit callconv() or inline - func_fancy instruction: When any of cc_ref, is_var_args, noalias_bits, or is_noinline are present, emit func_fancy instead of func/func_inferred with the appropriate FuncFancy payload layout - fn_var_args: Track in AstGenCtx for body code that checks it - BuiltinValue constants: Add all ZIR_BUILTIN_VALUE_* defines to zir.h - addBuiltinValue helper: Emit extended builtin_value instructions Generic tracking (any_param_used, ret_ty_is_generic, ret_body_param_refs) is not yet implemented as it requires is_used_or_discarded support in ScopeLocalVal scope lookups. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
About
zig0 aspires to be an interpreter of zig 0.15.1 written in C.
This is written with help from LLM:
- Lexer:
- Datastructures 100% human.
- Helper functions 100% human.
- Lexing functions 50/50 human/bot.
- Parser:
- Datastructures 100% human.
- Helper functions 50/50.
- Parser functions 5/95 human/bot.
- AstGen: TBD.
Testing
Quick test:
zig build fmt test
Full test and static analysis with all supported compilers and valgrind (run before commit, takes a while):
zig build -Dvalgrind
Debugging tips
Test runs infinitely? Build the test program executable:
$ zig build test -Dno-exec
And then run it, capturing the stack trace:
gdb -batch \
-ex "python import threading; threading.Timer(1.0, lambda: gdb.post_event(lambda: gdb.execute('interrupt'))).start()" \
-ex run \
-ex "bt full" \
-ex quit \
zig-out/bin/test
You are welcome to replace -ex "bt full" with anything other of interest.
Languages
Zig
96.3%
C
2.7%
C++
0.6%
Python
0.1%