Skip to content

hyperpolymath/eclexia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

License

Palimpsest

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.ecl

The 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

  1. 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

  1. 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
    { /* ... */ }
}
  1. 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
}
  1. 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) }

  1. 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": { / …​ */ } }

πŸ“Š Benchmarks & Results

Eclexia delivers measurable benefits:

Metric Improvement Workload

Energy Reduction 20-40% Typical web server

Battery Life +25-35% Mobile applications

Carbon Footprint 40-60% With carbon-aware scheduling

Developer Time 50-70% less Optimization vs. manual tuning

See benchmarks/ for detailed results and methodology.

πŸ§ͺ Research & Formal Foundations

Eclexia is built on solid theoretical foundations: Formal Proofs

We provide mathematical proofs for:

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

Discord: https://discord.gg/eclexia (coming soon)

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

Eclexia is dual-licensed: Open Source (Core)

License: Apache 2.0

Applies to: Core language, reference compiler, standard library

See: LICENSE

Commercial (Enterprise Features)

License: Proprietary

Applies to: Advanced optimizations, cloud services, enterprise support

🚧 Roadmap

Phase 1: Research Preview (Q4 2025)

βœ… White paper published

βœ… Formal proofs completed

βœ… Language specification v1.0

πŸ”„ Reference compiler (basic)

πŸ”„ Core standard library

Phase 2: Alpha Release (Q1 2026)

Optimizing compiler Runtime with shadow prices IDE plugin (VSCode) Basic benchmarks Community building

Phase 3: Beta Release (Q2 2026)

Production-ready compiler Advanced optimizations Carbon-aware scheduling Comprehensive stdlib Documentation complete

Phase 4: 1.0 Release (Q3 2026)

Stable language spec Performance competitive with Rust/C++ Rich ecosystem (libraries, tools) Enterprise support available

πŸ™ 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: Research Preview / Pre-Alpha Eclexia is under active development. The language specification is stabilizing, but expect:

Breaking changes to syntax/semantics Incomplete compiler implementation Limited standard library Rough edges in tooling

Not yet ready for production use. We’re targeting Alpha release in Q1 2026 and Beta 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 Apache 2.0 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: October 30, 2025 Document Version: 1.0 Repository: https://gitlab.com/eclexia-lang/eclexia