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.preload_macro_librariesEvaluates the compile-time libraries and installs the compiler surface’s own definitions, once for this process.
Frontend.startTokenizes one input into a fresh unit with its own isolated Context.
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:353

Frontend.preload_macro_libraries

int Frontend.preload_macro_libraries(Frontend frontend)

Evaluates the compile-time libraries and installs the compiler surface’s own definitions, once for this process. Returns zero after reporting a failed preload, without publishing a partial session.

Source: src/frontend.x:306

Frontend.start

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

Tokenizes one input into a fresh unit with its own isolated Context. The caller must close the unit on either result.

Source: src/frontend.x:251

ParsedUnit

ParsedUnit.close

void ParsedUnit.close(ParsedUnit *unit)

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

Source: src/frontend.x:359

ParsedUnit.collect

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

Collects symbols and retains preprocessor outputs for adapter inspection.

Source: src/frontend.x:321

ParsedUnit.parse

int ParsedUnit.parse(ParsedUnit *p)

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

Source: src/frontend.x:342

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.