Skip to main content

Module compile

Module compile 

Source
Expand description

LOGOS Compilation Pipeline for CLI

Re-exports the compilation API from logicaffeine_compile.

This module provides access to the core compilation functions without requiring a direct dependency on the compile crate. The key export is compile_project, which transforms LOGOS source into Rust code.

§Architecture

The compilation pipeline is implemented in the logicaffeine_compile crate. This module simply re-exports those types for convenience within the CLI.

§Example

use std::path::Path;
use logicaffeine_cli::compile::compile_project;

let rust_code = compile_project(Path::new("src/main.lg"))?;
println!("Generated {} bytes of Rust", rust_code.rust_code.len());

Structs§

CompileOutput
Full compilation output including generated Rust code and extracted dependencies.
CrateDependency
A declared external crate dependency from a ## Requires block.
GenuineProjectionResult
Result of a genuine Futamura projection via self-application. Contains the LOGOS source of the residual and the discovered entry points.

Enums§

CompileError
Errors that can occur during the LOGOS compilation pipeline.

Functions§

compile_and_run
Compile and run a LOGOS program end-to-end.
compile_file
Compile a LOGOS source file. For single-file compilation without dependencies.
compile_program_full
Compile LOGOS source and return full output including dependency metadata.
compile_project
Compile a multi-file LOGOS project with dependency resolution.
compile_to_c
Compile LOGOS source to C code (benchmark-only subset).
compile_to_dir
Compile LOGOS source and write output to a directory as a Cargo project.
compile_to_rust
Compile LOGOS source to Rust source code.
compile_to_rust_checked
Compile LOGOS source to Rust with ownership checking enabled.
copy_runtime_crates
Copy the runtime crates to the output directory. Copies logicaffeine_data and logicaffeine_system.
decompile_source_text
encode_program_source
Encode a LogicAffeine program (given as source) into CProgram construction source.
encode_program_source_compact
Compact encoding: inlines simple expressions (literals, variables) to reduce encoding size by ~3x. Same semantics as encode_program_source but produces fewer Let statements.
genuine_projection2_residual
Run genuine PE(pe_source, pe_mini(targetStmts)) and return the specialized compiler residual as LOGOS source code.
genuine_projection3_residual
Run genuine PE(pe_source, pe_bti(targetExpr)) and return the specialized cogen residual as LOGOS source code.
interpret_program
Interpret LOGOS source and return output as a string.
pe_bti_source_text
pe_mini_source_text
pe_source_text
Returns the source text of the partial evaluator written in LogicAffeine.
projection1_source
First Futamura Projection: PE(interpreter, program) = compiled_program
projection1_source_real
Real Futamura Projection 1: pe(program) = compiled_program
projection2_source
Second Futamura Projection: PE(PE, interpreter) = compiler
projection2_source_real
Genuine Futamura Projection 2 via self-application: PE(pe_source, pe_mini(targetStmts))
projection3_source
Third Futamura Projection: PE(PE, PE) = compiler_generator
projection3_source_real
Genuine Futamura Projection 3 via self-application: PE(pe_source, pe_bti(targetStmts))
quote_pe_source
Encodes the partial evaluator as CProgram construction source code.
run_genuine_p2_on_target
Run genuine P2 on a specific target: PE(pe_source, pe_mini(target))
run_genuine_p3_on_target
Run genuine P3 on a specific target: PE(pe_source, pe_bti(target))
run_logos_source
Compile and run LOGOS source, returning stdout.
verify_no_overhead_source
Verify that a LogicAffeine program has no interpretive overhead.