Skip to main content

EML language and compiler for verified mathematical computation. 31 backends spanning software, GPU shaders, hardware (FPGA/ASIC), formal verification, and safety-critical systems.

Project description

Monogate Forge

CI PyPI VS Code Marketplace License: MIT Python

Forge is the EML language and compiler. Write a math kernel once, compile it to 32 different targets — software, GPU shaders, FPGA RTL, formal-verification proofs, and safety-critical avionics — with chain-order analysis and Lean-checkable contracts on every function.


Quick start

pip install monogate-forge

Create hello.eml:

module hello;

fn pid(error: Real, integral: Real, derivative: Real) -> Real
    where chain_order <= 0
    requires (-1.0 <= error && error <= 1.0)
    ensures  (-1.5 * 1.0 <= result && result <= 1.5 * 1.0)
{
    let kp = 1.0;
    let ki = 0.2;
    let kd = 0.3;
    kp * error + ki * integral + kd * derivative
}

Compile to every target at once:

eml-compile hello.eml --target all -o build/

You now have build/hello.c, build/hello.rs, build/hello.py, build/hello.lean, build/hello.v, build/hello.hlsl, build/hello.metal, build/hello.swift, … one file per target. Pick a single target instead:

eml-compile hello.eml --target rust -o hello.rs
eml-compile hello.eml --target c    -o hello.c
eml-compile hello.eml --target lean -o Hello.lean

A snippet of hello.rs:

#[inline(always)]
pub fn pid(error: f64, integral: f64, derivative: f64) -> f64 {
    debug_assert!((-1.0_f64) <= error && error <= 1.0_f64);
    let kp: f64 = 1.0;
    let ki: f64 = 0.2;
    let kd: f64 = 0.3;
    kp * error + ki * integral + kd * derivative
}

Five-minute tour: docs/quickstart.md. Full tutorial: monogate.dev/learn/eml/intro.


What you get

32 backends. Every kernel compiles to all of these from the same source.

Software (general-purpose)

Target Flag Tier
C99 --target c Free
C++17 --target cpp Free
Rust --target rust Free
Python 3 --target python Free
Go --target go Free
Java --target java Free
Kotlin --target kotlin Free
C# --target csharp Free
JavaScript --target javascript Free
MATLAB --target matlab Free
Swift --target swift Pro

Compiler IRs

Target Flag Tier
WebAssembly --target wasm Free
LLVM IR --target llvm Pro

GPU shaders

Target Flag Tier
HLSL (DirectX) --target hlsl Pro
GLSL (desktop) --target glsl Pro
GLSL ES --target glsles Pro
WGSL (WebGPU) --target wgsl Pro
Metal (Apple) --target metal Pro

Hardware (FPGA / ASIC)

Target Flag Tier
Verilog --target verilog Pro
SystemVerilog --target systemverilog Pro
VHDL --target vhdl Pro
Chisel / FIRRTL --target chisel Pro

Formal verification

Target Flag Tier
Lean 4 --target lean Free
Coq --target coq Pro
Isabelle/HOL --target isabelle Pro

Safety-critical

Target Flag Tier
Ada/SPARK --target ada Pro
AUTOSAR C --target autosar Pro
AADL --target aadl Pro
ROS 2 / C++ --target ros2 Pro

Gaming

Target Flag Tier
Luau (Roblox) --target luau Pro
GDScript (Godot) --target gdscript Pro

Blockchain

Target Flag Tier
Solidity (PRBMath SD59x18) --target solidity Pro

The Free tier — 12 targets covering general-purpose software (C, C++, Rust, Python, Go, Java, Kotlin, C#, JavaScript), web/edge runtimes (WebAssembly), MATLAB, and Lean 4 proofs — is enough to take any EML kernel from your laptop to the browser to a formal proof without a license. A Pro license unlocks the remaining 20: hardware (Verilog, VHDL, SystemVerilog, Chisel, LLVM IR), GPU shaders (HLSL, GLSL, GLSL ES, WGSL, Metal), Apple Swift, safety-critical (Ada, AUTOSAR, AADL, ROS 2), Coq, Isabelle/HOL, Solidity, and gaming (Luau, GDScript). Get a license at monogateforge.com/get-started.


VS Code extension

Install

ext install monogate.eml-lang

LSP features:

  • Chain-order on hover — every function shows its profiled chain order, cost class, and node count.
  • Completions — keywords (fn, let, where, requires, ensures, module, use), builtins (exp, ln, sin, cos, sqrt, tanh, pow, clamp, eml, …), stdlib modules.
  • Diagnostics — type errors, unbound identifiers, chain-order violations, contract failures.
  • FPGA status bar — for any function annotated @target(fpga), the status bar shows estimated LUT / DSP / latency for the selected device.
  • Format on save — canonical layout via eml-fmt.

Marketplace listing: monogate.eml-lang.


Why Forge

Industrial automation today is stuck on ladder logic — Boolean rungs from the 1960s that can't express transcendental functions, can't prove correctness, can't optimize node count, and treat PID loops as black boxes. Structured Text is marginally better but still opaque. MATLAB/Simulink + HDL Coder will get you to FPGA, but the math hides inside vendor library calls and you have no formal proof of precision.

EML makes every mathematical operation visible, measurable, optimizable, and formally verifiable. Every expression is an EML tree, every function carries a chain order, every contract becomes a Lean theorem. The same source compiles to your laptop, your microcontroller, your FPGA, your Solidity contract, and your formal proof — and the cross-target equivalence harness verifies they agree to the bit.


Documentation

  • Quickstart — pip install to first compile in 5 minutes.
  • Language reference — every keyword, builtin, type, and annotation.
  • Backends — every compilation target with its CLI flag, file extension, and tier.
  • Verify guide@verify, requires/ensures, Lean output, MachLib integration.
  • FPGA guide@target(fpga), LUT/DSP estimates, precision selection, vendor support.

External:


Contributing

See CONTRIBUTING.md. Bug reports and feature requests via GitHub issues.

License

Compiler is MIT (see LICENSE). Specific algorithmic methods covered by patents — open implementation, but commercial re-implementations may need a license. See patents/index.md.

Built by Mosa Creates LLC.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monogate_forge-0.2.0.tar.gz (354.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monogate_forge-0.2.0-py3-none-any.whl (465.2 kB view details)

Uploaded Python 3

File details

Details for the file monogate_forge-0.2.0.tar.gz.

File metadata

  • Download URL: monogate_forge-0.2.0.tar.gz
  • Upload date:
  • Size: 354.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for monogate_forge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6a385c0859e2008a30cd5586ecd17391deaf6ad5f8dd2c4dfd1eb67548563b32
MD5 341c383e114430603a04b559d1d6c46b
BLAKE2b-256 afc3a4ce1ac6162731ea2432bc9a97f50aca3da4e0a6d650c920e1f3119d7daf

See more details on using hashes here.

Provenance

The following attestation bundles were made for monogate_forge-0.2.0.tar.gz:

Publisher: release.yml on agent-maestro/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file monogate_forge-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: monogate_forge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 465.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for monogate_forge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f0e26a8466a429805170df5494aeeef2dc7dc7631cf7099fd6f2d3759f33367
MD5 fcc50c05d46b912c6cd993b64ce7dac3
BLAKE2b-256 b09c657e1a691320e7f7e777633e25b6b81c79c7be9a6b464c3d055c28fb741e

See more details on using hashes here.

Provenance

The following attestation bundles were made for monogate_forge-0.2.0-py3-none-any.whl:

Publisher: release.yml on agent-maestro/forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page