zyntex.code_generation¶
- class zyntex.code_generation.IPrinter(dispatcher)[source]¶
Base interface for all printers.
Each printer receives a dispatcher in its constructor and must implement print(target) to produce the output for a node.
- class zyntex.code_generation.PrinterConfiguration(line_ending='\\n\\n')[source]¶
Printer formatting options.
- Attributes:
line_ending: String used to join/terminate printed elements (e.g. “
“).
- class zyntex.code_generation.PrinterDispatcher(configuration=None)[source]¶
Collects printers and chooses the right one for each node.
You can register printers with add, remove them with remove, and use print to get code for any supported node.
- class zyntex.code_generation.premade.DefaultCodePrinter[source]¶
Printer that combines all default printers into one.
- class zyntex.code_generation.premade.FunctionPrinter(dispatcher)[source]¶
Printer for Zig function declarations.
- class zyntex.code_generation.premade.IDefaultPrintable(dispatcher)[source]¶
Base for printers that register themselves automatically.
Subclasses must define target_type() and will be added to the shared dispatcher.
- default_dispatcher = <zyntex.code_generation.printer.PrinterDispatcher object>¶
- class zyntex.code_generation.premade.SourceCodePrinter(dispatcher)[source]¶
Printer for Zig source code.
- class zyntex.code_generation.premade.SourceFilePrinter(dispatcher)[source]¶
Printer for Zig source file.
- class zyntex.code_generation.premade.TestPrinter(dispatcher)[source]¶
Printer for Zig test declarations.