Skip to main content

Squeal

Gleam-подобный язык для BEAM (виртуальной машины Erlang) с синтаксисом Python. Исходники — файлы .ee; компилятор генерирует Erlang Abstract Format и .beam так же, как Gleam 1.19.

Быстрый старт

Проект — каталог с деревом src/:

my_app/
└── src/
    └── hello.ee

hello.ee:

def hello():
    "hi"

Сборка:

python -m squeal build my_app

Запуск:

erl -pa my_app/build/dev/erlang/my_app/ebin -noshell \
  -eval 'io:format("~p~n", [hello:hello()]), halt().'
# => <<"hi">>

Модуль — это путь файла под src/: src/a/b/c.ee → модуль a@b@c; импорт from a.b.c import f → вызов a@b@c:f(...).

Язык

Синтаксис Python, семантика Gleam/Erlang:

  • неизменяемость: циклов for/while нет, мутация запрещена; x = x + 1 — переприсваивание (новое Erlang-имя X@1);
  • атомы — одинарные кавычки 'ok', строки — двойные "...";
  • if/else и match/case (в условии — только bool; несматченный match — «let it crash»);
  • классы class T(StartingWithAtom): x: int → кортеж {t, …};
  • lambda, list/dict comprehensions, декораторы;
  • print(x) — печать в stdout (питоновское представление значений), возвращает nil;
  • zip(a, b) — пары до конца короткого списка, enumerate(xs[, start]) — пары (номер, значение); оба неленивые и принимают только списки;
  • range(...) — питоновский range, но неленивый: возвращает список;
  • print/zip/enumerate/range можно переопределить своим def — имя разрешается как обычное (по имени);
  • методы стандартной библиотеки: d.keys()/values()/items()/get(), s.startswith/endswith/ lower/upper/strip/lstrip/rstrip/split/join/replace/splitlines, xs.count(x) у списков и кортежей;
  • == как в Python (1 == 1.0 → true), // % ** — Python-семантика.

Полные правила — в goal-and-requirements.md и architecture.md.

Разработка

python -m venv .venv
.venv/bin/pip install pytest
.venv/bin/python -m pytest

Тесты включают 18 паритет-пар с Gleam: на эквивалентном коде squeal и Gleam 1.19.2 генерируют одинаковые Erlang-формы. Для них нужен установленный gleam в PATH (сам компилятор Gleam в репозиторий не входит — для справки держите локальный клон gleam/, он в .gitignore).

Metadata

Release files for squealang 0.1.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 squealang 0.1.0
File Size Uploaded Provenance Actions
squealang-0.1.0.tar.gz 54.9 kB Without provenance Details for squealang-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for squealang 0.1.0
File Interpreter ABI Platform Actions
squealang-0.1.0-py3-none-any.whl Python 3 none any Details for squealang-0.1.0-py3-none-any.whl

Total release size: 93.8 kB

Release files / squealang-0.1.0.tar.gz

Download URL squealang-0.1.0.tar.gz
Size 54.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ae40ceb3f5336108394590a62a5610fc43a33e9aa365b9ff4dc20a95f7b9fede
BLAKE2b-256 checksum
How to use checksums
275a696f1f48a33c3986f54d688445a10ec03aa56ea70d751d6488605052d2da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / squealang-0.1.0-py3-none-any.whl

Download URL squealang-0.1.0-py3-none-any.whl
Size 38.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bb87a61505be95dcd334a4747fb512fd9536207efe61ec6797e613a05953b68
BLAKE2b-256 checksum
How to use checksums
0e848d1df0e285ec99a27fa7a53067460875312ea0011e1175aa14a0f09a09db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for squealang 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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