Eclexia: Economics-as-Code
A programming language where economics is a first-class paradigm Making resource-efficient, carbon-aware software the default, not the exception.
π What is Eclexia?
Eclexia introduces Economics-as-Code: a revolutionary programming paradigm where economic principlesβscarcity, trade-offs, and optimizationβare built into the language itself. Instead of treating performance and resource usage as afterthoughts, Eclexia makes them first-class concerns with:
Resource types with dimensional analysis (energy, time, memory, carbon)
Adaptive blocks that automatically select optimal algorithms based on runtime constraints
Shadow prices that guide decision-making using economic principles
Carbon-aware execution to minimize environmental impact
Multi-objective optimization declared directly in code
The Problem
Traditional programming forces developers to:
Manually optimize for performance, energy, or cost Hard-code algorithm choices that donβt adapt to changing conditions Ignore carbon footprint and sustainability Trade off between competing objectives with no principled framework
The Solution
Eclexia makes these decisions automatic and economically optimal:
adaptive def matrix_multiply(A: Matrix, B: Matrix) β Matrix @requires: energy < 100J, latency < 500ms @optimize: minimize energy, minimize carbon { @solution "gpu_accelerated": @when: gpu_available && matrix_size > 1000 @provides: energy: 50J, latency: 100ms, carbon: 5gCO2e { gpu::multiply(A, B) }
@solution "parallel_cpu":
@when: cpu_cores >= 4
@provides: energy: 80J, latency: 300ms, carbon: 8gCO2e
{
parallel::multiply(A, B)
}
@solution "naive":
@when: true // always available
@provides: energy: 30J, latency: 800ms, carbon: 3gCO2e
{
naive::multiply(A, B)
}
}
The runtime automatically selects the best solution based on:
Available resources (energy budget, CPU cores, GPU availability) Current carbon intensity of the power grid Shadow prices that reflect the true cost of resources Your declared optimization objectives
π Documentation
Core Documents
Document Description Audience
White Paper Comprehensive introduction to Economics-as-Code All readers
Formal Proofs Mathematical foundations and correctness proofs Researchers, PL theorists
IP Claims Intellectual property analysis and strategy Legal, business
Language Specification Complete language syntax and semantics Language implementers
Tutorial Getting started guide with examples Developers
API Reference Standard library documentation Developers
Quick Navigation
π New to Eclexia? Start with the White Paper (Section 1-3) or Tutorial π¬ Want the theory? Read the Formal Proofs and Language Specification πΌ Business/Legal interests? See IP Claims for patent strategy and commercialization π¨βπ» Ready to code? Check out Examples and Getting Started
π Quick Start
Installation
From this repository:
# Build from source (requires Rust 1.75+)
cargo build --release
# Verify the build works
cargo test
cargo run -- run examples/hello.eclThe compiler binary will be at target/release/eclexia.
Hello World with Resources
def main() β Unit @requires: energy < 1J { println("Hello, Economics-as-Code!") }
Your First Adaptive Function
adaptive def fibonacci(n: Int) β Int @requires: energy < 100J @optimize: minimize latency { @solution "memoized": @when: n > 20 @provides: energy: 50J, latency: 5ms { memo_fib(n) }
@solution "naive":
@provides: energy: 10J, latency: 100ms
{
if n <= 1 then n
else fibonacci(n-1) + fibonacci(n-2)
}
}
Run it:
cargo run -- run examples/fibonacci.eclπ‘ Key Features
-
Resource Types with Dimensions
Prevent bugs at compile time:
let energy: Energy = 100J let time: Time = 5s let power: Power = energy / time // β Correctly typed as Watts
-
Adaptive Execution
The runtime automatically chooses the best algorithm:
adaptive def sort(arr: Array[Int]) β Array[Int] @requires: energy < 50J, latency < 100ms @optimize: minimize energy { @solution "quicksort": @when: length(arr) > 100 @provides: energy: 40J, latency: 50ms { /* β¦β */ }
@solution "insertion_sort":
@when: length(arr) <= 100
@provides: energy: 10J, latency: 80ms
{ /* ... */ }
}
-
Shadow Prices
The runtime computes shadow pricesβthe marginal value of each resourceβto guide decisions:
def analyze() β Unit @observe: shadow_prices { // Runtime automatically computes: // - Ξ»_energy: how valuable is 1 more Joule? // - Ξ»_time: how valuable is 1 more millisecond? // - Ξ»_carbon: how valuable is 1g less CO2?
// Solutions are ranked by weighted cost:
// cost = Ξ»_energy * energy + Ξ»_time * time + Ξ»_carbon * carbon
}
-
Carbon-Aware Scheduling
Automatically defer work to low-carbon times:
async def train_model(data: Dataset) β Model @requires: carbon < 500gCO2e @optimize: minimize carbon @defer_until: grid_carbon_intensity < 100gCO2e/kWh { // This will wait for low-carbon electricity // Typical time: overnight or windy/sunny periods expensive_training(data) }
-
Multi-Objective Optimization
Declare trade-offs explicitly:
adaptive def compress(image: Image) β CompressedImage @optimize: minimize carbon, maximize quality { // Runtime finds Pareto-optimal solution // balancing carbon cost vs. image quality @solution "high_quality": { /* β¦β / } @solution "low_carbon": { / β¦β / } @solution "balanced": { / β¦β */ } }
π Expected Benefits (Projected)
|
Note
|
These are theoretical projections based on the language design. Measured benchmarks are not yet available. |
Metric Expected Improvement Workload
Energy Reduction 20-40% (projected) Typical web server
Battery Life +25-35% (projected) Mobile applications
Carbon Footprint 40-60% (projected) With carbon-aware scheduling
Developer Time 50-70% less (projected) Optimization vs. manual tuning
Benchmarking infrastructure exists (eclexia bench) but comprehensive results have not yet been measured.
π§ͺ Research & Formal Foundations
Eclexia is built on solid theoretical foundations: Formal Proofs
Coq and Agda files are present (1222 lines). Some theorems are fully proved; others are Admitted (assumed without proof) and remain to be completed. The proofs address:
Type Safety (progress & preservation)
Resource Safety (no budget violations, no resource leaks)
Economic Optimality (shadow prices converge to optimal values)
Dimensional Correctness (prevents unit errors)
Termination (under resource bounds)
See PROOFS.md for complete proofs. Type System
Eclexia extends traditional type systems with:
Resource types: Energy, Time, Memory, Carbon
Dimensional analysis: Track physical dimensions at type level
Constraint types: @requires, @provides, @optimize
Effect types: Track side effects (I/O, energy consumption)
Operational Semantics
We define a formal small-step operational semantics for Eclexiaβs core calculus, proving:
Progress: well-typed programs donβt get stuck
Preservation: evaluation preserves types
Determinism: same context β same selection
ποΈ Project Structure
eclexia/ βββ README.md # This file βββ WHITEPAPER.md # Comprehensive introduction βββ PROOFS.md # Formal mathematical proofs βββ IP_CLAIMS.md # Intellectual property strategy βββ SPECIFICATION.md # Language specification βββ LICENSE # Apache 2.0 β βββ compiler/ # Compiler source code β βββ src/ β β βββ parser/ # Lexer and parser β β βββ typechecker/ # Type system implementation β β βββ optimizer/ # Optimization passes β β βββ codegen/ # Code generation β βββ Cargo.toml β βββ runtime/ # Runtime system β βββ src/ β β βββ scheduler/ # Adaptive scheduler β β βββ profiler/ # Resource profiler β β βββ shadow/ # Shadow price computation β β βββ monitor/ # Runtime monitoring β βββ Cargo.toml β βββ stdlib/ # Standard library β βββ core/ # Core types and functions β βββ collections/ # Data structures β βββ io/ # Input/output β βββ carbon/ # Carbon-aware utilities β βββ examples/ # Example programs β βββ hello_world.ecl β βββ fibonacci.ecl β βββ matrix_multiply.ecl β βββ carbon_aware_ml.ecl β βββ benchmarks/ # Performance benchmarks β βββ energy/ β βββ latency/ β βββ carbon/ β βββ docs/ # Documentation β βββ TUTORIAL.md β βββ API.md β βββ GUIDE.md β βββ CONTRIBUTING.md β βββ tests/ # Test suite βββ unit/ βββ integration/ βββ correctness/
π€ Contributing
We welcome contributions! Eclexia is open-source (Apache 2.0) and community-driven. How to Contribute
Read CONTRIBUTING.md
Join our Discord/Slack community
Pick an issue from GitLab Issues
Submit a merge request (MR)
Areas of Interest
Compiler development (Rust) Type system research Runtime optimization
Standard library (collections, algorithms)
Benchmarking (energy, performance)
Documentation (tutorials, examples)
Tooling (IDE plugins, LSP)
π Community
Website: https://eclexia.org
Discord: https://discord.gg/eclexia (coming soon)
Email: info@eclexia.org
Forum: https://discuss.eclexia.org (coming soon)
Social Media
Twitter/X: @eclexialang (coming soon)
Mastodon: @eclexia@fosstodon.org (coming soon)
LinkedIn: Eclexia Project (coming soon)
π Academic Use
Eclexia is designed for research and education: Research Papers
We encourage academic papers about:
Language design and extensions Type system innovations Optimization algorithms Energy/carbon modeling Sustainability in computing
See docs/RESEARCH.md for research ideas. Teaching
Use Eclexia in courses on:
Programming language design Compilers and runtime systems Sustainable computing Operations research in CS Multi-objective optimization
See docs/TEACHING.md for course materials. Citation
If you use Eclexia in research, please cite:
@techreport{eclexia2025, title={Economics-as-Code: A Novel Programming Paradigm for Sustainable Computing}, author={Jewell, Jonathan D.A.}, year={2025}, month={October}, institution={Eclexia Project}, url={https://eclexia.org}, note={Version 1.0} }
π License
License: PMPL-1.0-or-later (Palimpsest License)
Applies to: All Eclexia source code, compiler, standard library, tooling.
See: LICENSE
π§ Roadmap
Phase 1: Core Compiler (Q4 2025) β Complete
β Language specification (draft) β Core compiler pipeline (Lexer β Parser β AST β TypeCheck β HIR β MIR β Bytecode β VM) - β Lexer with 95+ token types including dimensional literals (893 lines) - β Pratt parser with full expression and item parsing (3106 lines) - β Hindley-Milner type checker with Robinson unification (2210 lines) - β HIR lowering (desugaring, type annotations) - β MIR lowering (CFG representation, basic optimizations) - β Bytecode code generator - β Stack-based VM with resource tracking (934 lines) - β Tree-walking interpreter (separate execution path, 28 builtin tests) β Standard library (6 modules: core, collections, math, I/O, text, time β 1280 lines .ecl) β Developer toolchain - β CLI (build, run, check, fmt, lint, repl, init, new, test, bench, debug, doc, install) - β Project minter with 10 templates (bin, lib, web, cli, mcp, ssg, lsp, tool, framework, db-connector) - β REPL with expression evaluation - β Test runner and benchmark runner - β Package manager (manifest parsing, dependency resolution β registry is stub) - β LSP server (diagnostics, completion, go-to-def, references, symbols, hover, rename, signature help, formatting) - β Formatter (eclexia-fmt: functions, traits, impls, modules, effects) - β Linter (configurable rules) - β Interactive debugger (breakpoints, step, continue, stack/locals/callstack/resources inspection) β 246 library tests passing, zero warnings, 25 crates compiling β Documentation (specification, getting started guide, whitepaper, theory)
Phase 2: Ecosystem Foundation (Q1βQ2 2026) β In Progress
β License migration to PMPL-1.0-or-later π Core ecosystem libraries (json, http, crypto, regex, log β not yet started) π TEA web framework (planned) π Database connectors (Idris2 ABI + Zig FFI pattern β templates ready) π Package registry (HTTP client exists, server not yet deployed) π Playground / web REPL (not yet started) π Eclexia website (not yet started) β odds-and-sods-package-manager integration (Eclexia registry adapter committed) π Codebase annotation coverage improvement
Phase 3: Advanced Compiler (Q3 2026)
Reactive compilation via Salsa incremental database (structural crates exist, not wired in) Parallel module compilation Error recovery for resilient parsing Compile-time evaluation (comptime) Abstract interpretation for resource analysis Algebraic effect compilation (evidence-passing) Partial evaluation and adaptive specialization
Phase 4: Multi-Target + Production (Q4 2026)
Native backends (Cranelift for dev, LLVM for release β currently stubs that estimate sizes) WebAssembly backend (currently stub) Tiered execution (interpreter β VM β Cranelift β LLVM) Profile-guided optimization BytecodeModule serialization (file output) Formal verification completion (some Coq/Agda theorems currently Admitted) Production deployment infrastructure (Docker/Kubernetes manifests exist, untested)
Known Limitations (Current)
Backends (Cranelift, LLVM, WASM) are structural stubs β they estimate code sizes, not generate real machine code Runtime modules (scheduler, profiler, carbon, shadow) are 6-line stubs 10 reactive compiler crates exist structurally but are not wired into CLI commands BytecodeModule does not implement Serialize (no bytecode file output yet) Package registry server does not exist yet (client is a stub) Formal verification has Admitted/unproven theorems No benchmarks with measured results yet (projections only)
π Acknowledgments
Creator: Jonathan D.A. Jewell Contributors: Joshua B. Jewell (feedback and insights) Inspiration: This project draws on decades of research in:
Programming languages (Pierce, Wadler, Cardelli) Operations research (Dantzig, Karmarkar) Sustainable computing (Barroso, HΓΆlzle) Type theory (Hindley, Milner, Martin-LΓΆf)
Special Thanks:
The Rust community (for systems programming excellence) The PL research community (for foundational work) GitLab (for hosting our open-source project) Early adopters and beta testers
π Contact
General inquiries: info@eclexia.org
Research collaborations: research@eclexia.org
Commercial licensing: licensing@eclexia.org
Press & media: press@eclexia.org
Security issues: security@eclexia.org
π Why "Eclexia"?
The name "Eclexia" combines:
"Ec-" from "Economics"
"-lexia" from Greek "Ξ»ΞΞΎΞΉΟ" (lexis), meaning "word" or "speech"
Together: "Economic Speech" or "Economics in Language" It also evokes:
Eclectic: Drawing from diverse fields (CS, economics, sustainability)
Excellence: Striving for optimal, principled design
Ecology: Caring about environmental impact
π Status & Stability
Current Status: Alpha Eclexia is under active development. As of February 2026:
-
32/32 valid conformance tests passing (100%)
-
Full parser, interpreter, formatter, and linter functional
-
LSP server for IDE support
-
Type casting, pattern matching, adaptive functions, Option types all working
-
Resource tracking and shadow pricing operational
The language specification is stabilizing but expect breaking changes to syntax/semantics. Weβre targeting Beta release in Q2 2026.
βοΈ Legal
Patents
Some aspects of Eclexia may be subject to patent protection. See IP_CLAIMS.md for details. Patent Grant: If you use Eclexia under the PMPL-1.0-or-later license, you receive a royalty-free patent license for patents embodied in the open-source code. Trademarks
Eclexiaβ’ is a trademark of Jonathan D.A. Jewell / Eclexia Project
Economics-as-Codeβ’ is a trademark of Jonathan D.A. Jewell / Eclexia Project
Use of trademarks must comply with TRADEMARK_POLICY.md. Confidentiality
Some documents (e.g., IP_CLAIMS.md) contain strategic information. Distribution is limited. See headers in each document.
π― Mission
"Make resource-efficient, carbon-aware software the default, not the exception." We believe that:
Computing has a carbon footprint that must be addressed
Developers want to do the right thing but need better tools
Economic principles can guide better software design
Language-level support is more effective than libraries
Eclexia aims to make sustainable computing easy, automatic, and economically optimal.
Welcome to the future of programming. Welcome to Economics-as-Code. Welcome to Eclexia.
"The best way to predict the future is to invent it." β Alan Kay
Last Updated: February 9, 2026 Document Version: 1.1 Repository: https://gitlab.com/eclexia-lang/eclexia