Skip to main content

Ragul — an agglutinative programming language

Project description

Ragul

Ragul — from Hungarian rag (suffix/affix) + -ul (in the manner of a language). An experimental programming language whose core logic is modelled on agglutinative grammar.

Meaning is built by stacking suffixes onto a root — a suffix chain is a pipeline.

adatok-szűrve-rendezve-ból  5-felett-val  kimenet-ba  másol-va.
// FROM data→filter(>5)→sort,  INTO output,  AS copy

📖 Full documentation →


Install

Ragul is not yet on PyPI. Install from source:

git clone https://github.com/kory75/ragul.git
cd ragul
pip install -e ".[dev]"

Requires Python 3.11+.


Quick Start

# Run a program
ragul futtat hello.ragul

# Type-check without running
ragul ellenőriz hello.ragul

# Interactive REPL
ragul repl

# Start the LSP server (for editor integration)
ragul lsp

Examples

Hello World

program-nk-hatás
    üdvözlet-be  "helló világ"-t.
    üdvözlet-képernyőre-va.

Arithmetic pipeline

program-nk-hatás
    x-be  10-t.
    y-be  x-3-össze-2-szoroz-t.   // (10 + 3) × 2 = 26
    y-képernyőre-va.

Filter and sort a list

program-nk-hatás
    adatok-be  [7, 2, 15, 3, 9, 1, 12, 4]-t.
    eredmény-be  adatok-szűrve-rendezve-ból  5-felett-val  t.
    eredmény-képernyőre-va.
// [7, 9, 12, 15]

Define and call a custom suffix

// Define -kétszeres as a reusable suffix
kétszeres-unk
    szám-d.
    szám-szám-össze-t.

program-nk-hatás
    x-be  7-t.
    y-be  x-kétszeres-t.    // 14
    y-képernyőre-va.

Conditionals

besoroló-nk-ha
    szám-d.
    szám-100-felett-ha
        "nagy"-t.
    -különben-ha  szám-50-felett-ha
        "közepes"-t.
    -hanem
        "kicsi"-t.

program-nk-hatás
    kategória-be  75-besoroló-ha-t.
    kategória-képernyőre-va.
// közepes

Loops

// Sum a list using fold
összesítő-nk-gyűjt
    elem-d.
    összeg-d.
    összeg-elem-össze-t.

program-nk-hatás
    lista-be  [1, 2, 3, 4, 5]-t.
    összeg-be  lista-összesítő-gyűjt-t  0-val.
    összeg-képernyőre-va.
// 15

Error handling

program-nk-hatás
    tartalom-be  "adat.txt"-fájlolvasó-va-e.
    tartalom-képernyőre-va.
    -hibára
        hiba-képernyőre-va.

What's in v0.1.0

Feature Status
Lexer with full alias normalisation
Parser → Scope tree (indentation-based)
Static type checker (E001–E009, W001)
Interpreter — assignment, arithmetic, pipelines
All loop kinds: -míg, -ig, -mindegyik, -gyűjt
Conditionals: -ha / -hanem / -különben-ha
Error propagation: -e and -hibára
Effect scopes (-nk-hatás) + I/O channels
Stdlib: arithmetic, comparison, logical, string, list, math
CLI: futtat, ellenőriz, fordít, repl, lsp
Interactive REPL with persistent environment
LSP server: diagnostics, hover, completion, go-to-def
Agent architecture with Claude AI error analysis
GitHub Actions CI (pytest + mypy on every push)
Documentation site (GitHub Pages)

Architecture

ragul/
├── model.py          # Word, Sentence, Scope, RagulType + alias table
├── lexer.py          # Tokeniser with alias normalisation at lex time
├── parser.py         # Two-pass: word construction + scope tree assembly
├── typechecker.py    # Static type checker, E001–E009, W001
├── interpreter.py    # Tree-walking interpreter
├── errors.py         # Structured error types and formatters
├── config.py         # ragul.config TOML loader
├── main.py           # CLI entry point
├── stdlib/
│   ├── core.py       # Arithmetic, comparison, logical, string concat
│   └── modules.py    # matematika, szöveg, lista modules
├── agents/
│   ├── orchestrator.py   # Coordinates the pipeline; Claude AI error analysis
│   ├── task.py           # Task / TaskResult message protocol
│   └── ...               # LexerAgent, ParserAgent, TypeAgent, InterpAgent, ...
├── repl/
│   └── repl.py       # Interactive REPL
└── lsp/
    └── server.py     # pygls LSP server

Running Tests

pytest ragul/tests/ -v

With type checking:

python -m mypy ragul/ --ignore-missing-imports

Suffix Alias Quick Reference

Each suffix has a canonical Hungarian form plus English and symbolic aliases:

Role Canonical English Symbol
Source (from) -ból / -ből -from -<
Target (into) -ba / -be -into ->
Instrument (with) -val / -vel -with -&
Object (acted on) -t -obj -*
Action (execute) -va / -ve -doing -!
Error propagation -e -else-fail -?

REPL

ragul repl
>>> x-be  3-t.
>>> y-be  x-kétszeres-t.
>>> y-képernyőre-va.
6
>>> :mutat
x = 3  (Szám)
y = 6  (Szám)
>>> :kilep

ragul.config

Place at your project root:

[projekt]
nev     = "my-project"
verzio  = "0.1.0"
belepes = "main.ragul"

[ellenorzes]
harmonia = "warn"   # "warn" | "strict" | "off"
tipus    = "warn"   # "warn" | "strict" | "off"

License

Apache 2.0 — see LICENSE for the full text.

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

ragul_lang-0.1.0.tar.gz (57.3 kB view details)

Uploaded Source

Built Distribution

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

ragul_lang-0.1.0-py3-none-any.whl (67.1 kB view details)

Uploaded Python 3

File details

Details for the file ragul_lang-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for ragul_lang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 315d3b05e68e417167bcbd2ab1dace48c569adec558e45f8b9b8ef653f532ae1
MD5 7c71ec33347e7d61efce2049d3183a39
BLAKE2b-256 939a56b99ec7d05fa1b89533c236ae2ffc7169095aacc5d28d67ae7fde93fd62

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragul_lang-0.1.0.tar.gz:

Publisher: publish.yml on kory75/ragul

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

File details

Details for the file ragul_lang-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for ragul_lang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b40a4cc14299cff9876a8bdfade863a7612c0b11aa39ffbb22b521f5433454ef
MD5 179fe9a13e99993fd5b7d924b21eb160
BLAKE2b-256 c4ea468160a47fbe5e1f259c3589254cbaf8deedb90e3f8a775e247cbff5df6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragul_lang-0.1.0-py3-none-any.whl:

Publisher: publish.yml on kory75/ragul

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