code wiki / (root) / main.nx

main.nx

buildroot/runtime/main.nx

3203 B84 linesdepth 7pulls 22 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

main.nx -- NishiLang-side compiler driver. Pipeline: source text -> lex -> parse -> opt -> regalloc -> riscv -> write-to-stdout. Stands in for main.c. Real source-file reading (openat + read + grow buffer) is a follow-up; this turn drives the pipeline from an in-memory source string so the whole stack of nx-side modules links cleanly through a single entry point. Once file I/O is in syscalls.nx and string concatenation lands, this driver becomes the authoritative NishiLang compiler -- the C nxc2 retires behind it.

dependencies 9 imports · 0 importers

syscalls.nx types.nx lex_kinds.nx ir.nx lex.nx parse.nx opt.nx regalloc.nx riscv.nx main.nx

imports: syscalls.nxtypes.nxlex_kinds.nxir.nxlex.nxparse.nxopt.nxregalloc.nxriscv.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main compile lex_source skip_ws_comments peek advance peek2 peek ↻ is_alpha lex_ident_or_kw tok_text_ptr peek ↻ is_alnum is_alpha ↻ is_digit advance ↻ keyword_lookup push_tok is_digit ↻ lex_number peek ↻ peek2 ↻ advance ↻ is_hexdigit is_digit ↻ hex_val push_tok ↻ is_digit ↻ lex_string advance ↻ tok_text_ptr ↻ peek ↻ push_tok ↻ peek2 ↻ emit_punct advance ↻ push_tok ↻ advance ↻ push_tok ↻ parse_module

structs

none

consts

none

functions

27func compile(src: *u8) -> i64 {
75func main() -> i64 {
calls 1: compile