Skip to main content

Neuva — A working ML programming language with lexer, parser, AST and interpreter

Project description


 ███╗   ██╗███████╗██╗   ██╗██╗   ██╗ █████╗
 ████╗  ██║██╔════╝██║   ██║██║   ██║██╔══██╗
 ██╔██╗ ██║█████╗  ██║   ██║██║   ██║███████║
 ██║╚██╗██║██╔══╝  ██║   ██║╚██╗ ██╔╝██╔══██║
 ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║  ██║
 ╚═╝  ╚═══╝╚══════╝ ╚═════╝   ╚═══╝  ╚═╝  ╚═╝

A programming language built purely for Machine Learning.

Simple like Python. Clear like Rust. Made for ML.


License: AGPL v3 Python 3.10+ PyTorch Backend Status: Building PRs Welcome



What is Neuva?

Neuva (NOO-vah) is an open source programming language designed from the ground up for Machine Learning. No boilerplate. No imports. No configuration. Just describe your model and train it.

# Train a digit classifier — the entire program
let data = load("mnist.csv")
let train_data, test_data = data.split(0.8)

model DigitNet {
    layer dense(784 -> 128, relu)
    layer dense(128 -> 10,  softmax)
}

train DigitNet on train_data for 20 epochs, lr=0.001
print accuracy(DigitNet, test_data)

That is it. No import torch. No nn.Module. No training loop. Neuva handles it all.


Why Neuva?

Most ML code looks like this:

import torch
import torch.nn as nn
import torch.optim as optim

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.fc1 = nn.Linear(784, 128)
        self.fc2 = nn.Linear(128, 10)

    def forward(self, x):
        x = torch.relu(self.fc1(x))
        return torch.softmax(self.fc2(x), dim=1)

model = Net()
optimizer = optim.Adam(model.parameters(), lr=0.001)
criterion = nn.CrossEntropyLoss()

for epoch in range(20):
    for batch_x, batch_y in train_loader:
        optimizer.zero_grad()
        output = model(batch_x)
        loss = criterion(output, batch_y)
        loss.backward()
        optimizer.step()

Neuva code looks like this:

model DigitNet {
    layer dense(784 -> 128, relu)
    layer dense(128 -> 10,  softmax)
}

train DigitNet on train_data for 20 epochs, lr=0.001

Same result. A fraction of the code.


Features

  • ML-first keywordsmodel, layer, train, predict, save are built into the language
  • No boilerplate — no imports, no class definitions, no training loops
  • PyTorch backend — compiles to PyTorch under the hood, so it is fast and compatible
  • Rust-style errors — clear error messages with line numbers and helpful hints
  • Simple typestensor, matrix, int, float, bool, string
  • Beginner friendly — if you know any programming language, you can write Neuva
  • Open source — AGPL v3 licensed, built in public, contributions welcome

Language Overview

Variables

let name   = "Neuva"        # string  (inferred)
let layers = 3              # int     (inferred)
let rate: float = 0.001     # float   (explicit)
let ready: bool = true      # bool    (explicit)

Models

model MyNet {
    layer dense(784 -> 128, relu)      # input 784, output 128, relu activation
    layer dense(128 -> 64,  relu)
    layer dense(64  -> 10,  softmax)   # output layer
}

Supported layer types: dense, conv, pool, dropout, flatten, norm

Supported activations: relu, sigmoid, softmax, tanh, linear, gelu

Loading Data

let data = load("dataset.csv")

let train_data, test_data = data.split(0.8)   # 80/20 split
data = data.normalize()                        # normalize values
data = data.shuffle()                          # shuffle rows

Training

# one-liner
train MyNet on train_data for 10 epochs, lr=0.001

# multi-line (more readable)
train MyNet
    on    train_data
    for   50 epochs
    lr    = 0.0005
    loss  = crossentropy

Supported loss functions: crossentropy, mse, mae, huber, binary_crossentropy

Predict and Evaluate

let result = predict MyNet on test_data
let acc    = accuracy(MyNet, test_data)
print "Accuracy:", acc

Save and Load

save MyNet to "my_model.nva"
let loaded = load("my_model.nva")

Functions

fn welcome(name: string) {
    print "Hello from Neuva,", name
}

fn square(x: float) -> float {
    return x * x
}

Control Flow

if acc > 0.95 {
    print "Excellent model!"
} else {
    print "Keep training."
}

for i in 0..10 {
    print i
}

Documentation

Document Description
Getting Started Install, hello world, running .nva files
Language Reference Every keyword with syntax and examples
Examples Line-by-line walkthrough of the iris classifier

Examples

File Description
examples/hello.nva Hello world
examples/iris_classifier.nva Iris flower classification
examples/digit_classifier.nva MNIST digit recognition
examples/regression.nva House price regression
examples/full_pipeline.nva End-to-end ML pipeline

Install

Neuva is currently in early development. The interpreter is being built in public.

Once released:

pip install neuva-lang

Run a .nva file:

neuva run my_model.nva

Project Status

Neuva is being built live, day by day, in public.

Phase Status Description
1 — Design ✅ Done Language syntax and keywords
2 — GitHub Setup ✅ Done Repo, license, structure
3 — Lexer 🔨 In progress Tokenizer
4 — Parser ⏳ Upcoming AST builder
5 — Interpreter ⏳ Upcoming Tree walker
6 — PyTorch backend ⏳ Upcoming ML execution
7 — PyPI release ⏳ Upcoming pip install neuva-lang

Follow the journey on LinkedIn — posting every milestone.


Contributing

Neuva is open source and we welcome all contributors — beginners and experts alike.

git clone https://github.com/Ankit-Mahadani/neuva.git
cd neuva
pip install -e ".[dev]"
pytest tests/

See CONTRIBUTING.md for the full guide.

Look for issues labelled good first issue to get started quickly: github.com/Ankit-Mahadani/neuva/issues


Built With

  • Python 3.10+ — the interpreter is written in Python
  • PyTorch — ML execution backend
  • NumPy + Pandas — data handling

Roadmap

  • Lexer + Parser (current focus)
  • Working interpreter for basic programs
  • PyTorch backend for model training
  • pip install neuva-lang on PyPI
  • VS Code syntax highlighting extension
  • GPU support
  • CNN and RNN layer types
  • Interactive REPL (neuva shell)
  • Web playground

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

This means:

  • You can use, study, modify, and distribute Neuva freely
  • If you use Neuva in a product or service (including over a network), you must release your source code under the same license
  • Any modifications must also be open source

This keeps Neuva and everything built on top of it free and open — forever.

See the full LICENSE file for details, or read a plain-English summary at tldrlegal.com/license/gnu-affero-general-public-license-v3.

Copyright © 2026 Ankit Mahadani and Neuva Contributors


Built in public. Day by day.

Star the repo to follow the journey.

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

neuva_lang-0.3.0.tar.gz (58.7 kB view details)

Uploaded Source

Built Distribution

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

neuva_lang-0.3.0-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file neuva_lang-0.3.0.tar.gz.

File metadata

  • Download URL: neuva_lang-0.3.0.tar.gz
  • Upload date:
  • Size: 58.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for neuva_lang-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b1db3236e94cc629edcfa43417004f505bcd5deff10b516319fd80b5ebb4298c
MD5 abfe202930e1afe63d3bc5fed01a45b4
BLAKE2b-256 f88202583a4e9c271933057363e79206e27f87fba06b5284b0542ce39fb053de

See more details on using hashes here.

File details

Details for the file neuva_lang-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: neuva_lang-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for neuva_lang-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d11b37511e56277967814398a7ec265209aceef1476ebfc20b6507e85a7e4248
MD5 506c5aba87a8aace9a52b5ae81a5176e
BLAKE2b-256 acd5d3e2eb134b625ded58393f9da2c6d2d47125e91878ebcf4af38001324241

See more details on using hashes here.

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