Skip to main content

A TrackMania-themed syntax wrapper for Python

Project description

TrackLang

A programming language* using TrackMania terminology

TrackLang is a syntax-level wrapper around Python.


Overview

TrackLang is a domain-specific language that maps TrackMania-inspired terminology to standard Python constructs.

TrackLang does not introduce new semantics, runtime behavior, or execution models. All TrackLang programs are translated into valid Python and executed using the Python interpreter.

If it works in Python, it works in TrackLang.


Design Goals

  • Preserve full Python semantics
  • Avoid custom runtimes or interpreters
  • Keep translation logic simple and transparent
  • Remain honest about what the project is

Non-Goals

TrackLang does not aim to:

  • Improve performance
  • Replace Python
  • Introduce new language features
  • Be suitable for production use

Example

TrackLang source:

START_RACE main():
    PB time = 3

    LOOP_TRACK time FASTER_THAN 0:
        CHAT time
        PB time = time - 1
    FINISH
FINISH

GO main()

Translated Python:

     def main():
     time = 3
     while time > 0:
         print(time)
         time = time - 1

 main()

The programs are functionally identical.


Syntax Overview

TrackLang replaces a small set of Python keywords with TrackMania-themed aliases. All other syntax is standard Python.

Control Flow

TrackLang Python
START_RACE def
CHECKPOINT if
ALT_ROUTE elif
ELSE_ROUTE else
LOOP_TRACK while
LAP for
FINISH end

Statements

TrackLang Python
CHAT print
PB x = y x = y
GO f() f()
RESTART_MAP return
DNF break
RESET_RUN continue
INSTALLOPENPLANETPLUGIN {module} import {module}
INSTALLOPENPLANETPLUGIN {module} AS {alias} import {module} as {alias}
DOWNLOADFROMNADEO {module} {thing} from {module} import {thing}

Operators

TrackLang Python
FASTER_THAN >
SLOWER_THAN <
EQUALS ==
NOT_PB !=
AT_LEAST >=
AT_MOST <=

Indentation Model

TrackLang uses explicit block terminators.

  • Blocks begin with control statements
  • Blocks end with FINISH
  • Indentation is generated automatically during translation

This removes whitespace sensitivity while preserving Python compatibility.


Installation

pip install tracklang

Usage

tracklang example.tm

Limitations

  • Errors originate from Python
  • Debugging occurs in translated Python
  • No sandboxing is provided

Intended Use

TrackLang is intended for:

  • Educational experiments
  • Language tooling exploration
  • Demonstrations
  • Jokes taken seriously

It is not recommended for production systems. Seriously. It isn't.

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

tracklang-0.2.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

tracklang-0.2.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file tracklang-0.2.1.tar.gz.

File metadata

  • Download URL: tracklang-0.2.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tracklang-0.2.1.tar.gz
Algorithm Hash digest
SHA256 090e64fed1d69e8f140fcd77dbfc58ca33d6f370c93ea82a22ab31d965068eef
MD5 62c4f9d2cd05dcb86bafb71f720b4362
BLAKE2b-256 96a170d16c5c0b9cef66bcfc06cf9d71c153d46457af9cfaea473c3065163934

See more details on using hashes here.

Provenance

The following attestation bundles were made for tracklang-0.2.1.tar.gz:

Publisher: python-publish.yml on Melodii7785/TrackLang

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

File details

Details for the file tracklang-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: tracklang-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tracklang-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2bdb7cf716fdd8490d99d7797b142294c3226ba052e922be9f5840277624b142
MD5 5145419ab7ce83cb00893547858eb076
BLAKE2b-256 3b89dd5a322ca54373d370c1e347fd5e0f0270b582a2026c29f08455f84a8d54

See more details on using hashes here.

Provenance

The following attestation bundles were made for tracklang-0.2.1-py3-none-any.whl:

Publisher: python-publish.yml on Melodii7785/TrackLang

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