Skip to content

Mirocow/pyrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

76 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pyrl Banner

Pyrl Logo

Pyrl β€” Hybrid Python + Perl Programming Language

Power of Perl. Simplicity of Python. One Language.

Features β€’ Quick Start β€’ Documentation β€’ Examples β€’ Tools

English | Русский


🎯 About

Pyrl (Python + Perl) is a modern hybrid programming language that combines Perl's expressive power with Python's readability and simplicity. The language uses Perl's sigil-based variable system ($scalar, @array, %hash, &function) together with Python's control flow syntax and indentation.

Key Features

  • πŸ”₯ Sigil Variables β€” intuitive type recognition by prefix
  • 🐍 Python Syntax β€” familiar if, for, while, def constructs
  • πŸͺ Perl Power β€” regular expressions, built-in operators
  • πŸ—„οΈ SQLite Integration β€” native database operations
  • 🌐 Web Server β€” built-in HTTP server with REST API
  • πŸ€– AI Model β€” pretrained model for code generation

✨ Features

Sigil-Based Variables

$name = "Pyrl"          # Scalar ($)
@numbers = [1, 2, 3]    # Array (@)
%config = {             # Hash (%)
    "host": "localhost",
    "port": 8080
}
&handler = {            # Function (&)
    return "Hello!"
}

Python-Like Syntax

def greet($name):
    if $name:
        return "Hello, " + $name + "!"
    else:
        return "Hello, World!"

for $i in range(5):
    print($i)

Perl-Style Regular Expressions

$text = "Hello, World!"
if $text =~ m/World/:
    print("Found!")

$result = $text =~ s/World/Pyrl/

Web Applications

$app = {
    handle: &handle_request
}

def handle_request($req):
    %response = {
        "status": 200,
        "body": "Hello from Pyrl!"
    }
    return %response

πŸš€ Quick Start

Installation

# Clone repository
git clone https://github.com/pyrl-lang/pyrl.git
cd pyrl

# Install dependencies
pip install -r requirements.txt

Running

# Interactive console
python pyrl_cli.py

# Execute file
python pyrl_cli.py examples/01_hello_world.pyrl

# Web server
python scripts/run_web_app.py examples/web_server_auth.pyrl

Docker

# Start server
docker-compose up -d server

# Console
docker-compose run console

πŸ“š Documentation

Document Description
Language Documentation (EN) Complete syntax and features reference
ДокумСнтация языка (RU) ПолноС описаниС синтаксиса ΠΈ возмоТностСй
VSCode Extension Extension installation and usage
AI Model Model training and inference
Docker Services Containerization and deployment
Project Roadmap Development plans
CHANGELOG Version history

πŸ› οΈ Tools

VSCode Extension

Plugin for Visual Studio Code with syntax highlighting, autocompletion, and snippets.

cd vscode-pyrl
code --install-extension .

Features:

  • 🎨 Syntax highlighting
  • πŸ“ Quick construction snippets
  • πŸ” Variable autocompletion

AI Model Generator

Train your own model for Pyrl code generation:

# Generate model
python scripts/generate_model.py

# Training
python scripts/train_model.py --epochs 10

# Inference
python scripts/model_inference.py

Pretrained Model

The repository includes a pretrained model:

  • Location: models/pyrl-model/
  • Tokenizer: BPE, 10,000 tokens
  • Architecture: Transformer-based

πŸ“ Project Structure

pyrl/
β”œβ”€β”€ src/
β”‚   └── core/
β”‚       β”œβ”€β”€ lark_parser.py      # LALR parser
β”‚       └── vm/
β”‚           β”œβ”€β”€ vm.py           # Virtual machine
β”‚           β”œβ”€β”€ builtins.py     # Built-in functions
β”‚           β”œβ”€β”€ builtins_db.py  # SQLite functions
β”‚           └── builtins_http.py # HTTP functions
β”œβ”€β”€ vscode-pyrl/                # VSCode extension
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ generate_model.py       # Model generator
β”‚   └── train_model.py          # Model training
β”œβ”€β”€ models/pyrl-model/          # Pretrained model
β”œβ”€β”€ examples/                   # Code examples
β”œβ”€β”€ docker/                     # Docker configs
└── documents/                  # Documentation

πŸ“‹ Examples

File Description
01_hello_world.pyrl Hello World
01_variables.pyrl Variables
04_functions.pyrl Functions
06_classes.pyrl Classes
08_builtins.pyrl Built-in functions
20_perl_regex.pyrl Regular expressions
web_server_auth.pyrl Auth web server

πŸ§ͺ Testing

# Run all tests
make test

# Specific test
python -m pytest tests/test_vm.py -v

πŸ—ΊοΈ Roadmap

See PROJECT_ROADMAP.md for development plans.

Current Version: 2.3.0

  • βœ… SQLite integration
  • βœ… Web server with REST API
  • βœ… AI model for code generation
  • βœ… VSCode extension

Planned

  • πŸ”„ JIT compilation
  • πŸ”„ Standard library
  • πŸ”„ Package manager
  • πŸ”„ Debugger

🀝 Contributing

We welcome contributions!

  1. Fork the repository
  2. Create a branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

πŸ“„ License

MIT License β€” use freely for any purpose.


Pyrl β€” bringing the best of Python and Perl together

About

Hybrid Python-Perl Inspired Language with AI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors