Tags: None
State: None
Tokenizer
Token = (tag, pos)
- State machine
- Token-by-token, not stored in memory
Parser
AST Node = (tag, main_token, data)
tag = type of node main_token = index in token data = (lhs, rhs)
Example:
func decl, has:
- func name
- param list
- return type
- body, etc.
lhs == function prototype node rhs == function body
lhs, rhs points to either nodes or extradata in the parser
extradata == array of Index how many fields = defined by tag
for prototype it's 6 fields, defined as a struct: (start/end of params,
alignexpr, addrspaceexpr, sectionexpr, callconvexpr)
Backend
- main.zig
- buildOutputType
- Compilation object created
- ZIR is first generated
Compiler.zig
binfile: link.File
--watch command
Sources:
- Entry
- Update
- comp.makeBinFileWritable
- updateModule
- comp.update