Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/frontend.x

Configured compiler sessions and sequential source units.

Functions

FunctionSummary
Frontend.load_supportLoads process-owned collection support before units.
Frontend.newBorrows a configured request for sequential units.
Frontend.openRuns the source stages.
Frontend.startOpens and tokenizes an isolated source unit without printing diagnostics.
ParsedUnit.closeReleases the unit after its caller has inspected or exported its results.
ParsedUnit.collectCollects symbols and retains preprocessor outputs for adapter inspection.
ParsedUnit.parseParses a collected unit, retaining both its AST and unsuccessful reports.

Frontend

Frontend.load_support

void Frontend.load_support(CliRequest request)

Loads process-owned collection support before units.

Source: src/frontend.x:69

Frontend.new

Frontend Frontend.new(CliRequest request)

Borrows a configured request for sequential units. The request and this session must outlive its units. Initialize process support above any temporary command Context before creating a session inside that Context.

Source: src/frontend.x:77

Frontend.open

int Frontend.open(Frontend f, String filename, ParsedUnit *unit)

Runs the source stages. On either result, the caller must close the unit.

Source: src/frontend.x:279

Frontend.start

int Frontend.start(Frontend frontend, String filename, ParsedUnit *unit)

Opens and tokenizes an isolated source unit without printing diagnostics. A failed unit remains open so its diagnostics can be inspected. Close it before opening the next unit; Type and collection caches are process-global.

Source: src/frontend.x:216

ParsedUnit

ParsedUnit.close

void ParsedUnit.close(ParsedUnit *unit)

Releases the unit after its caller has inspected or exported its results.

Source: src/frontend.x:286

ParsedUnit.collect

int ParsedUnit.collect(ParsedUnit *unit, Frontend frontend)

Collects symbols and retains preprocessor outputs for adapter inspection.

Source: src/frontend.x:247

ParsedUnit.parse

int ParsedUnit.parse(ParsedUnit *p)

Parses a collected unit, retaining both its AST and unsuccessful reports.

Source: src/frontend.x:268

Public types

TypeKindSummary
FrontendstructBorrows a configured request and owns shared native-preprocessor setup.
FrontendErrorSinkcallbackReceives borrowed native-preprocessor stderr synchronously during collect.
ParsedUnitstructOwns one isolated source lifetime, including unsuccessful diagnostics.

Frontend

typedef struct Frontend { CliRequest request; List include_dirs; Toolchain toolchain; FrontendErrorSink preprocessor_errors; } *Frontend

Borrows a configured request and owns shared native-preprocessor setup. Units open sequentially; process caches must outlive the session. The optional stderr sink runs synchronously; units also retain that text.

Source: src/frontend.x:23

FrontendErrorSink

typedef void (*FrontendErrorSink)(String text)

Receives borrowed native-preprocessor stderr synchronously during collect.

Source: src/frontend.x:17

ParsedUnit

typedef struct ParsedUnit { Context context; Compiler compiler, preprocessor; Map globals; List ast; String preprocessor_output, preprocessor_errors; int source_lines, generated_symbols; } ParsedUnit

Owns one isolated source lifetime, including unsuccessful diagnostics. Results remain borrowed until close; export values that must survive it.

Source: src/frontend.x:33

Design notes

Shares source setup, collection, parsing, and unit lifetimes between the command-line compiler and internal tools. Adapters own printing and exit.