1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//! # logicaffeine_compile
//!
//! The compilation pipeline for LOGOS, transforming natural language logic
//! into executable Rust code.
//!
//! ## Architecture
//!
//! ```text
//! LOGOS Source
//! │
//! ▼
//! ┌─────────┐ ┌───────────┐ ┌──────────┐
//! │ Lexer │ ──▶ │ Parser │ ──▶ │ AST │
//! └─────────┘ └───────────┘ └──────────┘
//! │
//! ┌──────────────────────────────────┘
//! ▼
//! ┌─────────────────────────────────────────────┐
//! │ Analysis Passes │
//! │ ┌─────────┐ ┌───────────┐ ┌───────────┐ │
//! │ │ Escape │ │ Ownership │ │ Z3 │ │
//! │ └─────────┘ └───────────┘ └───────────┘ │
//! └─────────────────────────────────────────────┘
//! │
//! ▼
//! ┌──────────┐ ┌────────────┐
//! │ CodeGen │ ──▶ │ Rust Code │
//! └──────────┘ └────────────┘
//! ```
//!
//! ## Feature Flags
//!
//! | Feature | Description |
//! |---------|-------------|
//! | `codegen` | Rust code generation (default) |
//! | `verification` | Z3-based static verification |
//!
//! ## Modules
//!
//! - [`compile`]: Top-level compilation functions
//! - [`codegen`]: AST to Rust code generation (requires `codegen` feature)
//! - [`analysis`]: Static analysis passes (escape, ownership, discovery)
//! - [`extraction`]: Kernel term extraction to Rust
//! - [`interpreter`]: Tree-walking AST interpreter
//! - [`diagnostic`]: Rustc error translation to LOGOS-friendly messages
//! - [`sourcemap`]: Source location mapping for diagnostics
//! - [`loader`]: Multi-file module loading
//! - [`ui_bridge`]: Web interface integration
//! - `verification`: Z3-based static verification (requires `verification` feature)
//!
//! ## Getting Started
//!
//! ### Basic Compilation
//!
//! ```
//! use logicaffeine_compile::compile::compile_to_rust;
//! # use logicaffeine_compile::ParseError;
//! # fn main() -> Result<(), ParseError> {
//!
//! let source = "## Main\nLet x be 5.\nShow x.";
//! let rust_code = compile_to_rust(source)?;
//! # Ok(())
//! # }
//! ```
//!
//! ### With Ownership Checking
//!
//! ```
//! use logicaffeine_compile::compile::compile_to_rust_checked;
//!
//! let source = "## Main\nLet x be 5.\nGive x to y.\nShow x.";
//! // Returns error: use-after-move detected at check-time
//! let result = compile_to_rust_checked(source);
//! ```
//!
//! ### Interpretation
//!
//! ```no_run
//! use logicaffeine_compile::interpret_for_ui;
//!
//! # fn main() {}
//! # async fn example() {
//! let source = "## Main\nLet x be 5.\nShow x.";
//! let result = interpret_for_ui(source).await;
//! // result.lines contains ["5"]
//! # }
//! ```
// Re-export base types
pub use ;
// Re-export language types needed for compilation
pub use ;
// Re-export kernel for extraction
pub use logicaffeine_kernel as kernel;
// Module loading
pub use ;
// Compile-time analysis
// Code generation
// C code generation (benchmark-only subset)
// Compilation pipeline
pub use ;
// Diagnostics
// Source mapping
// Extraction (proof term extraction)
// Optimization passes
// Interpreter
// UI Bridge - high-level compilation for web interface
// Verification pass (Z3-based, requires verification feature)
pub use VerificationPass;
// Re-export UI types at crate root for convenience
pub use ;
pub use generate_rust_code;
// Provide module aliases for internal code