Skip to main content

Makrell: A programming language family

Project description

MakrellPy

impl/py contains the Python implementation track for Makrell.

Status:

  • Actively maintained for compatibility and ecosystem continuity.
  • No longer the reference implementation; MakrellTS in impl/ts is the reference.

Website and documentation: makrell.dev

Current editor workflow: ../../vscode-makrell/README.md

Quick start

Installation

pip install makrell

Package smoke check from a built artefact:

python -m build
python -m venv .pack-smoke
.pack-smoke\Scripts\python.exe -m pip install <wheel-file-from-dist>
.pack-smoke\Scripts\makrell.exe --help
.pack-smoke\Scripts\makrell-langserver.exe --help

Run tests

cd impl/py
python -m pytest

MakrellPy REPL usage

makrell
> 2 + 3
5
> [2 3 5] | sum
10

Run a MakrellPy script

makrell myscript.mrpy

MakrellPy by example

Syntax

# This is a comment.
a = 2
b = a + 3
{sum [a b 5]}  # function call
[a b 5] | sum  # function call by pipe operator
sum \ [a b 5]  # function call by reverse pipe operator

# Conditional expression
{if a < b
    "a is less than b"
    "a is not less than b"}

# Function definition
{fun add [x y]
    x + y}

# Partial application
add3 = {add 3 _}
{add3 5}  # 8

# Pattern matching
{match a
    2
        "two"
    [_ 3|5]
        "list with two elements, second is 3 or 5"
    _:str
        "a string"
    _
        "something else"
}

Other features

See examples/ and tests/ for:

  • Class definitions
  • String interpolation
  • Async/await
  • Functional programming utilities
  • Metaprogramming and macros
  • Python interoperability
  • editor/LSP support

Async/await

MakrellPy is still the strongest current reference for the broader Makrell async surface.

Shared family baseline:

  • {async fun ...}
  • {await expr}

MakrellPy also has Python-shaped extensions such as:

  • {async for ...}
  • {async with ...}

Checked-in examples:

  • examples/makrellpy/coroutines.mr
  • examples/makrellpy/async_for.mr
  • examples/makrellpy/async_with.mr

Run the coroutine example from impl/py/:

makrell examples/makrellpy/coroutines.mr

Macro showcase

One of the nicest current MakrellPy showcase examples is:

  • examples/macros/showcase.mr

It collects three small macros that are worth surfacing for v0.10.0:

  • pipe
    • reshapes a sequence of forms into pipeline style
  • rpn
    • turns postfix input into ordinary Makrell AST
  • lisp
    • hosts a Lisp-like round-bracket notation inside Makrell

Run it:

makrell examples/macros/showcase.mr
makrell check examples/macros/showcase.mr --json

These are good examples not because they are large, but because they show three different macro uses: ergonomic rewriting, alternative notation, and language embedding.

MRON example

owner "Rena Holm"
last_update "2023-11-30"

books [
    {
        title  "That Time of the Year Again"
        year   1963
        author "Norton Max"
    }
    {
        title  "One for the Team"
        year   2024
        author "Felicia X"
    }
]

MRML example

{html
    {head
        {title A Test}
    }
    {body
        {h1 This is a Test}
        {p [style="color: red"] Just some {b bold} text here.}
    }
}

MRTD example

name:string age:int active:bool
Ada 32 true
"Rena Holm" 29 false

Python API:

from makrell.mrtd import parse_src, read_records, read_tuples, write_records

doc = parse_src("""
name:string age:int active:bool
Ada 32 true
Ben 41 false
""")

records = read_records("""
name:string age:int active:bool
Ada 32 true
Ben 41 false
""")

Profile example:

from makrell.mrtd import parse_src

doc = parse_src("""
when bonus
"2026-04-03"dt 3k
""", profiles=("extended-scalars",))

Makrell Base Format (MBF)

MBF supports identifiers, strings, numbers, bracketed lists ((), [], {}), operators, comments, and binary expressions.

Relationship to MakrellTS

MakrellTS (impl/ts) is the reference implementation for ongoing language evolution. MakrellPy remains important for parity testing, interoperability checks, and existing Python-based workflows. For the current editor workflow across MakrellPy, MakrellTS, Makrell#, MRON, MRML, and MRTD, see ../../vscode-makrell/README.md.

Licence

Makrell is developed by Hans-Christian Holm and licensed under the MIT licence. See LICENSE for details.

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

makrell-0.10.0.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

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

makrell-0.10.0-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file makrell-0.10.0.tar.gz.

File metadata

  • Download URL: makrell-0.10.0.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for makrell-0.10.0.tar.gz
Algorithm Hash digest
SHA256 b77e7f6515a869bbb6d521514b3714b957880a1ba8be6c8bab2e87e02e826820
MD5 68790c26cbeb36259c1bc5712308ae95
BLAKE2b-256 c99fd13751d885d57445e2667905e6acd8d0fbcea6519776ff8124da4019c46e

See more details on using hashes here.

File details

Details for the file makrell-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: makrell-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for makrell-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 259b66b8fa952b6a54f8e7184f68cf63f0e8af6867e817d4488fe3c12c1221e3
MD5 09b589de2224fda3fba7ab64f20a63fc
BLAKE2b-256 32ce0d042808fd0c871f011bac42a7007e25e87858c079425fd313d72c0b38c7

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