Skip to main content

RAGL — a memory-safe, flexible-syntax, AI-native programming language

Project description

RAGL

RAGL

Ragulraj's Advanced General Language
One language. Every domain.

language 1.0 · compiler 0.1.0 · runtime 0.1.0 · IR 1
Created by Ragulraj Dhamodharan · Shivoraa


RAGL is a memory-safe, dynamically typed, flexible-syntax language with a batteries-included standard library and a first-class AI engine.

Flexible syntax means many surface forms, one canonical meaning — every dialect is a deterministic rewrite to the same AST. RAGL has a formal grammar, a static checker, structured diagnostics and a conformance suite, and ragl explain will show you exactly what your program became.

create variable name with value "Ragulraj"     # all six of these
set name to "Ragulraj"                         # produce exactly
let name be "Ragulraj"                         # the same node:
name is "Ragulraj"                             #
name → "Ragulraj"                              #   Assign(name, 'Ragulraj')
name = "Ragulraj"                              #

Install

pip install ragl-lang            # the CLI is `ragl`

Note on the name: pip install ragl installs an unrelated retrieval-augmented-generation library that already owns that name on PyPI. The distribution here is ragl-lang; the import name and command are both ragl.

Optional extras:

pip install "ragl-lang[ai]"      # real model access for the `ai` phrases
pip install "ragl-lang[crypto]"  # AES-256-GCM and bcrypt (both have fallbacks)
pip install "ragl-lang[all]"

From source:

git clone https://github.com/ragulraj/ragl && cd ragl
pip install -e .
python -m unittest discover -s tests

Requires Python 3.9+. No mandatory dependencies.

Hello, RAGL

echo 'say "Hello World"' > hello.ragl
ragl run hello.ragl
Hello World

The command line

Command What it does
ragl run app.ragl check, then run
ragl check app.ragl diagnostics without running
ragl explain app.ragl print the canonical IR
ragl repl interactive session
ragl modules built-in modules and their capabilities
ragl install ./lib · ragl list · ragl uninstall lib packages
ragl version all four version surfaces

Capabilities are granted, not assumed:

ragl run app.ragl --allow files            # files only
ragl run app.ragl --allow files,network
ragl run app.ragl --allow ""               # pure computation

A tour

# Conditions in three dialects, one meaning
if age is greater than 18
    say "Adult"
otherwise
    say "Minor"
end

say "Adult" if age > 18

# Loops with skip / stop / retry
for each item at index in ["red", "green", "blue"]
    skip if item is "green"
    say "{index}: {item}"
end

# Functions, defaults, lambdas, closures
define greet with who, greeting = "Hello"
    return "{greeting}, {who}!"
end
double = value → value * 2

# The full object model
interface Shape
    needs area
end

abstract class Figure implements Shape
    has name
    has private id
    shared created = 0
    define area
        return 0
    end
end

class Circle extends Figure
    has radius
    create with radius
        super create with "Circle"
        self.radius = radius
    end
    define area
        return PI * self.radius * self.radius
    end
    define text
        return "Circle(r={self.radius})"
    end
end

c = new Circle(2)
say c.area                # 12.56636 — a zero-parameter method reads as a property
say c is a Shape          # true
say c                     # Circle(r=2)

# Files
write to file "notes.txt" with "Hello RAGL"
say read file "notes.txt"

# A real database
connect to database "app.db"
create table Users with
    id auto increment primary
    name text required
    email text unique required
end
insert into Users
    name = "Ragulraj"
    email = "rag@shivoraa.in"
end
say get from Users where name == "Ragulraj"

# Security, with the construction documented
hashed = hash "myPassword" using bcrypt
say check if "myPassword" matches hashed

# AI — offline by default, so this runs with no key
say ai analyze "I love this product" for sentiment     # positive

# An HTTP API
start server on port 8080
route GET "/"
    send "Welcome to the RAGL API"
end

# Concurrency
run together
    a = secure get "https://example.com/one"
    b = secure get "https://example.com/two"
end

Every snippet above is exercised by examples/ and tests/.

Examples

ragl run examples/01-hello.ragl          # the six dialects
ragl run examples/02-basics.ragl         # types, conditions, loops, functions
ragl run examples/03-collections.ragl    # lists, dicts, sets, stacks, queues
ragl run examples/04-objects.ragl        # the full object model
ragl run examples/05-errors.ragl         # structured errors
ragl run examples/06-files.ragl          # file handling
ragl run examples/07-database.ragl       # SQLite
ragl run examples/08-security.ragl       # hashing, encryption, JWT
ragl run examples/09-ai.ragl             # the AI engine
ragl run examples/10-web.ragl            # page → HTML
ragl run examples/11-server.ragl         # HTTP API (Ctrl-C to stop)
ragl run examples/12-concurrency.ragl    # parallel, background, timers

How it works

source ─▶ lexer ─▶ intent resolver ─▶ parser ─▶ canonical AST ─▶ checker ─▶ interpreter
                   (deterministic,                    │
                    no model call)                    └─ `ragl explain` prints this

The canonical AST is the contract between the front end and the runtime. A bytecode VM can replace the interpreter without changing what any program means.

Documentation

Document Covers
01 — Language Specification the normative language reference
02 — Compiler lexer, intent resolver, parser, IR, checker
03 — Runtime execution, memory, concurrency, security, objects
04 — Standard Library every module and phrase
05 — Package Manager packages, resolution, versioning
06 — AI Engine providers, agents, non-goals
07 — Errors the full diagnostic catalogue
08 — Grammar formal EBNF
09 — Scope what RAGL is, and what it deliberately is not
10 — Roadmap versioning, plan, governance

What RAGL does not do

RAGL states its boundary rather than implying there isn't one. It has no raw pointers, no manual memory management, no templates, and no multiple implementation inheritance — those contradict its memory-safety guarantee or its dynamic type system. Generators, operator overloading and a bytecode VM are planned, not present. Benchmarks will be published only once the VM exists. Details: docs/09-scope.md.

Publishing (maintainer)

python -m build                  # → dist/ragl_lang-0.1.0-py3-none-any.whl + .tar.gz
python -m twine upload dist/*    # needs your PyPI credentials

License

MIT © 2026 Ragulraj Dhamodharan

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

ragl_lang-0.1.0.tar.gz (99.7 kB view details)

Uploaded Source

Built Distribution

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

ragl_lang-0.1.0-py3-none-any.whl (72.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ragl_lang-0.1.0.tar.gz
  • Upload date:
  • Size: 99.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for ragl_lang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 edec050ece1443375c3eb2332ca9761168a6aa1d439ef37e07d1679a2082c942
MD5 ba3aabf91e2e54f64b7092499375b649
BLAKE2b-256 0aaa1eabb6bd846220c4fa16e6e6df069d93e1db5b2c3603bae07ec305e60cf7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ragl_lang-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 72.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for ragl_lang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38f646ade146f373e7c09e1d49c571843b84f71ae24bc9ab495b04cbf171b4b6
MD5 1dd93ddc2f19151bd0976050d93f16da
BLAKE2b-256 36c8e0d9c297abad1020856f969a72eac8446ea709fe73cffa9b7cd2e72e2d40

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