MADOLA

December 20, 2025 ยท View on GitHub

Math-Driven Coding with Automatic Documentation.

MADOLA integrates mathematical notation, computation, documentation, and code generation within a single file. It is not intended to replace existing languages or applications. MADOLA is still in its early stages and under active development.

Screenshot

๐Ÿ‘‰ Try it here: Playground

๐Ÿงญ Why Not Create a New Wheel?

Because existing tools each solve only part of the problem.

ProblemExisting ToolsLimitation
You want readable math and executable codeLaTeX / TypstStatic, non-executable
You want strong computationPython / Julia / MATLABRequires libraries; syntax differs from standard math notation
You want visual documentationMathcad / Mathematica / MapleProprietary and closed
You want modern web deploymentNone of the aboveNo native WASM or HTML flow
You want AI to help youNone of the aboveNo direct AI support

MADOLA exists because no single tool unites mathematics, documentation, and computation in an open, compiler-based environment.

Itโ€™s not another wheel โ€” itโ€™s the hub connecting them all.


๐Ÿ’ก What is MADOLA?

MADOLA stands for MAth DOmain LAnguage.

It looks like math, runs like code, and publishes like LaTeX.

  • ๐Ÿงฎ Mathematical syntax โ€” write equations exactly as you would on paper
  • ๐Ÿ“ Built-in documentation โ€” generate HTML with LaTeX-style formatting and equations
  • ๐Ÿค– AI-powered โ€” let AI assist you with MADOLA code (under development)
  • ๐Ÿ”„ Version control friendly โ€” plain-text source works seamlessly with Git and other tools
  • ๐Ÿ“ฆ Import system โ€” reuse functions or load external WASM modules
  • ๐Ÿงฉ Rich language features โ€” supports functions, matrices, complex numbers, and units
  • โšก High performance โ€” WASM execution can be 5โ€“25ร— faster than standard AST evaluation
  • โš™๏ธ Code generation โ€” compile directly to C++ or WebAssembly (WASM)
  • ๐ŸŒ Cross-platform โ€” works on Windows, Linux, and macOS
  • ๐Ÿง  Tree-sitter integration โ€” syntax highlighting and IDE support for VS Code, Vim, and Emacs

โœ๏ธ Literate Mathematical Programming

Although it is organized as source code, it is built on the belief that code should map directly to clear, expressive LaTeX-style mathematics. It naturally blends executable logic with human-readable documentation.

@h2{
Function to calculate ฯ€ Using the Leibniz Series
}

@gen_cpp
fn calcPi(n) {
    sum := 0.0;
    for i in 0...n{
        sum := sum + ((-1)^i) / ((2*i)+1);
    }
    return sum * 4;
}

This single .mda file can execute directly, generate HTML documentation with LaTeX equation and produce optimized C++ or WASM modules

Screenshot

#include <cmath>

double calcPi(double n)
{
    double sum = 0;
    for (int i = 0; i <= n; i++) {
        sum = (sum + (pow(-1, i) / ((2 * i) + 1)));
    }
    return (sum * 4);
}

โ†’ One source = code, math, and explanation.


๐Ÿ”ฌ Comparison with Other Systems

See detailed comparisons with Mathcad, Python/Julia, Mathematica/Maple/MATLAB, and LaTeX/Typst.


โš™๏ธ Code Generation & Extensibility

From a single .mda file, MADOLA can output:

  • ๐Ÿง  Executable math programs
  • ๐Ÿงพ HTML documentation
  • ๐Ÿ’ป Optimized C++ source
  • ๐ŸŒ WASM modules for browsers
@gen_cpp
fn integrate(f, a, b, n) {
    h := (b - a) / n;
    return h * math.summation(f(i), i, 1, n);
}

๐Ÿง  Why It Matters

MADOLA bridges the gap between:

  • Code and explanation
  • Notation and execution
  • Desktop and web

Itโ€™s ideal for:

  • Research papers with live math
  • Engineering formulas with computation
  • Educational material with examples
  • Web apps with real math logic

๐ŸŒŸ Language Guide

See the Language Guide for syntax examples.


๐ŸŒŸ Documentation Generation

Command-Line Usage

MADOLA provides a command-line interface for executing programs and generating documentation.

Basic Syntax:

madola <file.mda> [--html]

Arguments:

  • <file.mda> - MADOLA source file to process (required)
  • --html - Output HTML format with integrated graphs and math (optional)

Examples

Execute a MADOLA file:

# Windows
.\dist\madola.exe example.mda

# Linux/macOS
./dist/madola example.mda

Generate HTML report:

# Output to stdout (can be redirected to file)
.\dist\madola.exe example.mda --html > output.html

# Using dev.bat wrapper (Windows)
.\dev.bat run example.mda --html > report.html

# Using dev.sh wrapper (Linux/macOS)
./dev.sh run example.mda --html > report.html

HTML Output Features

When using the --html flag, MADOLA generates a complete HTML document with:

  • MathJax Integration - Beautiful rendering of mathematical expressions
  • Execution Results - Computed values displayed inline with code
  • Formatted Output - Proper styling for headings, paragraphs, and tables
  • Graph Support - Visual plots and charts (if included in your code)
  • LaTeX-Style Math - Professional mathematical notation
  • Responsive Design - Works on desktop and mobile browsers

The generated HTML file is self-contained and can be opened directly in any modern web browser.


Development Guide

See the Development Guide for syntax examples.

License

MADOLA is distributed under the Apache License. We reserve the right to adopt a dual-license scheme for commercial/business use in the future.

Join or Support Us

You can help by donating or contributing to the project. We welcome developers, testers, and support volunteers โ€” even a $10 donation makes a real difference. Sending us Claude Code or Codex Credits would greatly help us. MADOLA is a non-profit initiative; any simply help sustain the project. With sufficient funding, we can create more full-time positions and speed up development.

Premium Services

We also offer premium services to help your business integrate MADOLA effectively:

  • WYSIWYG editor
  • Assistance with self-hosted setup
  • Cloud applications and storage
  • Custom domain and WebAssembly (WASM) solutions
  • Get help through phone support or in-person training

Roadmap

We are currently working toward the 1.0 stable release. Our long-term goals include:

  • AI-powered interactive coding environment
  • WYSIWYG editor and interactive UI input
  • Symbolic computation (integration, differentiation, etc.)
  • Expanding into fields such as physics, chemistry, mechanics and many others
  • 3D modeling support
  • Integration with React and Vue components

Current TODO List

  1. Higher-order functions - Functions as first-class values
  2. GitHub Actions CI/CD - Automated builds, tests, and releases
  3. Symbolic math - Differential, integration, and equation solver support
  4. Image/SVG support - Generate and manipulate images and SVG graphics
  5. File I/O - Read and write CSV and text files
  6. WebGPU support - GPU-accelerated computations and visualizations
  7. Document mode (WYSIWYG) - Rich text editor alongside code mode

For the complete detailed roadmap, see docs/TODO.md.

Pull Requests

  • You can use AI tools to assist with coding.
  • Always review all changes carefully before submitting a pull request.
  • Keep pull requests small and focused to make review easier.