Skip to content

Instantly share code, notes, and snippets.

@matu3ba
Last active August 25, 2021 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matu3ba/6381175f3ce79df4638f8614fbae2e8e to your computer and use it in GitHub Desktop.
Save matu3ba/6381175f3ce79df4638f8614fbae2e8e to your computer and use it in GitHub Desktop.
quickly_made_zig_structure.md
entry points: main.zig -> main() -> buildOutputType() -> Compilation.create()
Main steps how assembly is generated
1. lib/std/zig/tokenizer.zig -> Token (same file)
2. lib/std/zig/parse.zig -> AST (lib/std/zig/ast.zig)
3. src/AstGen.zig -> Zir (src/Zir.zig)
4. src/Sema.zig -> Air (src/Air.zig)
5. src/codegen.zig -> LLVM/C backend/etc
Future plan
change step 5 and add step 6 to something like
- 5 src/emir.zig -> LLVM, WebAssembly, C, SPIR-V or
Mir (src/backend/aarch64Mir.zig)
- 6. src/codegen.zig -> assembly/machine code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment