Expand description
§FormaLang
A compiler frontend library for the FormaLang declarative language.
Parsing, semantic analysis, and IR lowering are built-in; code generation
is the responsibility of embedders via the plugin system.
§Entry points
compile_to_ir— compile source to a resolvedIrModule.compile_to_ir_with_resolver— same, with a customsemantic::module_resolver::ModuleResolver.compile_with_analyzer— returns the AST plusSemanticAnalyzerfor LSP-style use.parse_only— lex + parse without semantic analysis.compile_and_report— convenience wrapper that formats errors as a human-readable report.
§Plugin system
Embedders compose IrPass transforms and a Backend via Pipeline.
Built-in passes live in ir::DeadCodeEliminationPass and
ir::ConstantFoldingPass.
Re-exports§
pub use ast::Definition;pub use ast::Expr;pub use ast::File;pub use ast::Ident;pub use ast::Statement;pub use ast::Type;pub use error::CompilerError;pub use ir::simple_type_name;pub use ir::EnumId;pub use ir::FunctionId;pub use ir::GenericBase;pub use ir::ImportedKind;pub use ir::IrFunction;pub use ir::IrFunctionParam;pub use ir::IrFunctionSig;pub use ir::IrImport;pub use ir::IrImportItem;pub use ir::IrModule;pub use ir::ResolvedType;pub use ir::StructId;pub use ir::TraitId;pub use lexer::Lexer;pub use lexer::Token;pub use location::Location;pub use location::Span;pub use parser::parse_file;pub use parser::parse_file_with_source;pub use pipeline::Backend;pub use pipeline::IrPass;pub use pipeline::Pipeline;pub use pipeline::PipelineError;pub use reporting::report_error;pub use reporting::report_errors;pub use semantic::module_resolver::FileSystemResolver;pub use semantic::SemanticAnalyzer;
Modules§
- ast
- Abstract Syntax Tree (AST) for
FormaLang - error
- ir
- Intermediate Representation (IR) for
FormaLang - lexer
- location
- parser
- pipeline
- Backend pipeline for IR transformation and code generation.
- reporting
- semantic
- Semantic analysis (validation only — no evaluation or expansion).
Functions§
- compile_
and_ report - Compile to IR, formatting errors as a human-readable report on failure.
- compile_
to_ ir - Compile
FormaLangsource code into an IR module. - compile_
to_ ir_ with_ path - Compile
FormaLangsource to IR with a known source-file path. - compile_
to_ ir_ with_ path_ and_ resolver - Compile
FormaLangsource to IR with both a custom resolver and a known source-file path. - compile_
to_ ir_ with_ resolver - Compile
FormaLangsource code to IR with a custom module resolver. - compile_
with_ analyzer - Compile and return both the AST and the semantic analyzer.
- compile_
with_ analyzer_ and_ resolver - Compile with a custom resolver, returning both AST and analyzer.
- parse_
only - Parse
FormaLangsource without semantic analysis.