Skip to main content

NEX

PyPI Version Python Version Unit Tests Docs License: GPLv3

NEX is a small experimental programming language implemented in Python.

Nex logo

The project currently includes:

  • a lexer
  • a recursive-descent parser
  • a tree-walking interpreter
  • a small CLI runner
  • an mdBook documentation site under docs/

Example

int x = 0;
while(x < 10) {
    print(x);
    x = x + 1;
}

Installation

Install the package in editable mode:

python -m pip install -e .

Once published, the package can be installed from PyPI with:

python -m pip install nex-lang

Install development dependencies as well:

python -m pip install -e ".[dev]"

Enable the local pre-commit hook to block commits when formatting, linting, or ASCII-only checks fail:

pre-commit install

Running Programs

The package exposes a nexlang command:

nexlang examples/hello.nex

You can check the installed CLI version with:

nexlang --version

You can also run the CLI module directly:

python -m nex.cli examples/hello.nex

The CLI also supports a few inspection and reporting options:

nexlang tokens examples/hello.nex
nexlang ast examples/hello.nex
nexlang --times examples/hello.nex
nexlang run --times --color examples/hello.nex
  • tokens prints the token stream and stops after lexing.
  • ast prints the parsed syntax tree and stops after parsing.
  • --times shows a formatted timing summary for the lexer, parser, interpreter, and total runtime after the program finishes.
  • --color (or -c) colorizes the timing summary. It is intended to be used together with --times.

Documentation

The language reference lives in the mdBook project under docs/.

Build it locally with:

python scripts/generate_grammar_diagrams.py
~/.cargo/bin/mdbook build docs

The grammar page diagrams are generated from the fenced grammar block in docs/src/reference/grammar.md, so rerun the generator whenever that grammar changes.

Once GitHub Pages is enabled for this repository, the published book will be available at:

https://ifilot.github.io/nex-lang/

VS Code Syntax Highlighting

A lightweight VS Code syntax-highlighting extension for .nex files lives at:

editors/vscode/nex-syntax

If you are using VS Code through WSL, you can expose that extension to the WSL server with:

cd editors/vscode/nex-syntax
mkdir -p ~/.vscode-server/extensions && ln -s "$(pwd)" ~/.vscode-server/extensions/local.nex-syntax

After that, reload the VS Code window.

Releases

PyPI releases are published from Git tags that start with v. The published package name is nex-lang. The installed CLI command remains nexlang.

Before publishing, the release workflow checks that the tag matches nex.__version__ exactly, for example v0.3.0, and that the package version does not already exist on PyPI.

For local releases, create the tag through the guarded helper:

python scripts/create_release_tag.py

The helper creates v<nex.__version__> only after checking that the local Git tag does not already exist and that the package version is still available on PyPI.

Testing

Run the test suite with:

python -m pytest -q tests

Using python -m pytest is the most reliable form across environments and editors.

Linting

Check linting, formatting, and ASCII-only text files with:

python -m ruff check .
python -m ruff format --check .
python scripts/check_ascii.py

Project Structure

nex/
  lexer/         Tokenization
  parser/        Recursive-descent parser
  interpreter/   AST nodes, environment, and interpreter
  cli.py         Command-line entry point
tests/           Unit tests
examples/        Example programs

Metadata

Release files for nex-lang 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nex-lang 0.3.0
File Size Uploaded
nex_lang-0.3.0.tar.gz 77.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nex-lang 0.3.0
File Interpreter ABI Platform
nex_lang-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 132.0 kB

Release files / nex_lang-0.3.0.tar.gz

Download URL nex_lang-0.3.0.tar.gz
Size 77.1 kB
Tags Source
SHA-256 checksum
How to use checksums
402453b7ff3c6d679d41996da517f1243cf767af73519d262653b0c7249dd106
BLAKE2b-256 checksum
How to use checksums
a90459a580102ff5536213dfdfe6766dbf126a96110f6cfd6c48b8def92d87c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / nex_lang-0.3.0-py3-none-any.whl

Download URL nex_lang-0.3.0-py3-none-any.whl
Size 54.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cb7e0c8d27ceaec91f45636a8757a5db0277b61f50d9d73ae766c23215a0759
BLAKE2b-256 checksum
How to use checksums
085cb66481e133cc887ccf277496fd7d026fd9d0fe3f0fde391cee0708825774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page