A programming language designed for mathematical computations with precise arithmetic and symbolic expressions.
Mathium is a custom programming language that combines mathematical notation with modern programming language features. Built with arbitrary-precision arithmetic (GMP/MPFR), it's designed for applications requiring exact numerical computations.
Current Status: Complete rewrite from prototype. Core interpreter functional with variables, functions, and basic expressions. Undergoing systematic refactoring and documentation before feature expansion.
- Documentation - Language specification and design documents
- Devlog Series - Follow the development journey (coming soon)
- Contributing - How to contribute (coming soon)
- Arbitrary-precision arithmetic using GMP (integers) and MPFR (reals)
- Interactive REPL with multi-line input support
- Variable declarations with type inference and explicit typing
let x := 42 // Type inferred as Integer let y: Real := 3.14159 // Explicit type annotation - Function calls (builtin functions)
- Expression evaluation with proper operator precedence
- Error handling with source location tracking
- File-based script execution (
.mthxfiles) - Additional builtin operators (
-,*,/,^, etc.) - User-defined functions
- Classes and object-oriented features
- Comprehensive builtin function library
- Rich type system with inference, subtyping, and qualifiers (
const,ref) - Object model - Everything is an object, classes are objects
- Operator overloading for user-defined types
- Control flow -
if,while,for,matchstatements - Pattern matching and destructuring
- Symbolic expressions and computer algebra features
- Module system for code organization
- CMake 3.29.7 or higher
- C++20 compatible compiler
- GMP - GNU Multiple Precision Arithmetic Library
- MPFR - Multiple Precision Floating-Point Reliable Library
- Boost 1.74.0 or higher
# Install dependencies
sudo apt-get update
sudo apt-get install build-essential cmake libboost-all-dev libgmp-dev libmpfr-dev
# Clone and build
git clone https://github.com/PhoenXHO/Mathium.git
cd Mathium
mkdir build && cd build
cmake ..
makesudo dnf install cmake boost-devel gmp-devel mpfr-devel gcc-c++
# Then follow clone and build steps above# Install dependencies via Homebrew
brew install cmake boost gmp mpfr
# Clone and build
git clone https://github.com/PhoenXHO/Mathium.git
cd Mathium
mkdir build && cd build
cmake ..
make- Install CMake
- Install dependencies via vcpkg:
vcpkg install boost gmp mpfr
- Clone and build:
git clone https://github.com/PhoenXHO/Mathium.git cd Mathium mkdir build && cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake cmake --build .
Start the Mathium REPL:
./MathiumExample session:
Mathium> let x := 42
Mathium> let y := 3.14159
Mathium> x + y
45.14159
Mathium> let double := \n -> n * 2
Mathium> double(x)
84
quitorexit- Exit the interpreter\at end of line - Continue input on next line- Press Enter on empty line to cancel multi-line input
Usage: Mathium [<options>]
Options:
-h [ --help ] Display this help message
-v [ --version ] Display interpreter version and additional information
-f [ --file ] <file> Read from a file. <file> must have the `.mthx`
extension
-V [ --verbose ] Enable verbose output
-P [ --print-all ] Print all expressions that do not have a semicolon at
the end (if this option is not enabled, only the last
expression will be printed)
-b [ --benchmark ] Print the time taken to execute the program at the end
of execution (in microseconds)
-W [ --no-warn ] Disable warningsCreate a file hello.mthx:
let greet := \name -> "Hello, " ++ name ++ "!"
greet("World")
Run it:
./Mathium -f hello.mthxsrc/
โโโ frontend/ # Lexer, parser, AST
โโโ semantic/ # Type checking, symbol resolution
โโโ compiler/ # Bytecode generation
โโโ runtime/ # VM, object model, builtins
โโโ util/ # Error handling, config, debugging
See docs/ for detailed architecture documentation.
Contributions are welcome! This project is currently undergoing major refactoring. If you'd like to contribute:
- Check the roadmap (coming soon in
docs/contributing/) - Open an issue to discuss your proposed changes
- Follow the style guide (coming soon in
docs/contributing/) - Write tests for new features
- 0.2.0-alpha.1 (In Progress) - Complete rewrite with improved architecture
- 0.1.x - Initial prototype (deprecated)
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- GMP - Arbitrary precision integer arithmetic
- MPFR - Arbitrary precision floating-point arithmetic
- Boost - C++ utility libraries
- GitHub: @PhoenXHO
- Medium: Follow for devlogs (coming soon)
- LinkedIn: Connect for updates (coming soon)
Last Updated: November 21, 2025