Skip to main content

AI-Native Programming Language - Write code in natural language

Project description

AILang - AI-Native Programming Language

Write code in your native language. English, Spanish, Arabic, Chinese - the compiler understands them all.

Version License Python

🌟 What is AILang?

AILang is a revolutionary programming language where you write code in plain natural language. No syntax to memorize, no semicolons, no curly braces - just describe what you want in English, Spanish, Arabic, or any other language, and the AI compiler executes it.

Traditional Programming:

function toggleLight(pin) {
  const GPIO = require('rpi-gpio');
  GPIO.setup(pin, GPIO.DIR_OUT);
  GPIO.write(pin, true);
}

AILang Programming (English):

Turn on the light connected to GPIO pin 17

AILang Programming (Arabic):

شغل الضوء المتصل بمنفذ GPIO رقم ١٧

🚀 Quick Start

Installation

Linux/Mac:

curl -fsSL https://raw.githubusercontent.com/rulhaq/ailang/main/install.sh | bash

Windows (PowerShell as Admin):

iwr -useb https://raw.githubusercontent.com/rulhaq/ailang/main/install.ps1 | iex

Or install via pip:

pip install ailang-cli

Your First Program

  1. Create a new project:
ailang new my-first-app
cd my-first-app
  1. Edit src/main.en:
Create a button in the center that says "Click Me!". 
When clicked, show an alert saying "Hello from AILang!"
  1. Compile and run:
ailang compile src/main.en

Your browser opens with your running app! 🎉

📚 Features

✅ Multi-Language Support

Write code in any natural language - the file extension determines the language:

  • .en - English
  • .es - Spanish (Español)
  • .ar - Arabic (العربية)
  • .fr - French (Français)
  • .de - German (Deutsch)
  • .zh - Chinese (中文)
  • .ja - Japanese (日本語)
  • .hi - Hindi (हिन्दी)
  • .pt - Portuguese (Português)
  • .ru - Russian (Русский)

✅ Multiple Target Platforms

Compile to different platforms:

# Web applications (HTML/CSS/JS)
ailang compile app.en --target web

# Python scripts
ailang compile script.en --target python

# IoT/Raspberry Pi
ailang compile iot-device.en --target iot

# Mobile apps (coming soon)
ailang compile mobile.en --target mobile

✅ Local LLM Support

No cloud required! AILang works with local LLMs:

  • Ollama (Recommended) - Run models locally
  • llama.cpp - Lightweight C++ inference
  • Cloud APIs - Claude, GPT-4 (optional)

✅ IoT & Hardware Support

Control real hardware with natural language:

Read temperature from sensor on pin 4.
If temperature exceeds 30 degrees, turn on fan.
Send notification to my phone.

Supports:

  • Raspberry Pi GPIO
  • Arduino (via serial)
  • Sensors (DHT22, BMP280, etc.)
  • Actuators, relays, motors
  • Network communication

🛠️ Installation & Setup

Prerequisites

  • Python 3.8+ (required)
  • Ollama (recommended for local LLM) or Cloud API keys

Detailed Installation

1. Install AILang

Via curl (Linux/Mac):

curl -fsSL https://raw.githubusercontent.com/rulhaq/ailang/main/install.sh | bash

Via PowerShell (Windows):

iwr -useb https://raw.githubusercontent.com/rulhaq/ailang/main/install.ps1 | iex

Via pip:

pip install ailang-cli

From source:

git clone https://github.com/rulhaq/ailang.git
cd ailang
pip install -e .

2. Choose Your LLM Backend

Option A: Local LLM (Recommended - Free & Private)

Install Ollama:

# Mac
brew install ollama

# Linux
curl -fsSL https://ollama.ai/install.sh | sh

# Windows
# Download from https://ollama.ai

Pull a model:

ollama pull llama3.2
# or
ollama pull codellama

Configure AILang:

ailang setup -i
# Select: 1 (Ollama)
# Model: llama3.2

Option B: Cloud APIs

ailang config set llm_backend anthropic
ailang config set anthropic_api_key YOUR_API_KEY

3. Verify Installation

ailang --version
# AILang 1.0.0

📖 Usage Guide

Command Line Interface

# Create new project
ailang new <project-name> [-l <language>]

# Compile source file
ailang compile <file> [-o output] [-t target] [--no-open]

# Configuration
ailang config get [key]
ailang config set <key> <value>
ailang config list

# Setup wizard
ailang setup -i

Project Structure

myproject/
├── src/
│   ├── main.en          # Main source file
│   ├── components.en    # Reusable components
│   └── utils.es         # Spanish utilities
├── build/               # Compiled output
├── ailang.json          # Project configuration
└── README.md

Configuration File (ailang.json)

{
  "name": "myproject",
  "version": "1.0.0",
  "language": "en",
  "target": "web",
  "entry": "src/main.en",
  "output": "build",
  "llm_backend": "ollama",
  "ollama_model": "llama3.2"
}

💡 Examples

Web Application (English)

calculator.en:

Create a calculator app. Show a display area at the top for numbers.
Add buttons for digits 0-9, operations (+, -, *, /), clear, and equals.
Use a modern blue and white color scheme with rounded corners.
When users click buttons, perform calculations and show results.

Compile:

ailang compile calculator.en

IoT Device (English)

smart-garden.en:

Read soil moisture from sensor on pin 4 every hour.
If moisture is below 30%, turn on water pump on pin 17 for 10 seconds.
Log all readings with timestamps to a CSV file.
Send me an email if the moisture stays low for more than 6 hours.

Compile:

ailang compile smart-garden.en --target iot

Web App (Spanish)

todo.es:

Crear una aplicación de lista de tareas pendientes.
Mostrar un campo de entrada en la parte superior.
Agregar botón azul para crear nuevas tareas.
Mostrar tareas en una lista con casillas de verificación.
Usar diseño moderno con gradiente de azul a morado.

Compile:

ailang compile todo.es

IoT (Arabic)

security.ar:

قراءة حالة مستشعر الحركة على المنفذ ٢٣ كل ثانية.
إذا اكتشف حركة، تشغيل الإنذار على المنفذ ١٧.
التقاط صورة من الكاميرا وإرسالها إلى بريدي الإلكتروني.
تسجيل جميع الأحداث مع التاريخ والوقت.

Compile:

ailang compile security.ar --target iot

🎯 Advanced Usage

Multi-File Projects

main.en:

Load the login form from auth.en.
When user logs in successfully, show the dashboard from dashboard.en.

auth.en:

Create a login form with username and password fields.
Add a blue login button.
Validate credentials and return success or error.

Hot Reload Development

ailang compile app.en --watch

Edit your .en file and see changes instantly!

Custom LLM Endpoints

ailang config set llm_backend custom
ailang config set custom_endpoint http://localhost:8000/v1/generate

Environment Variables

export AILANG_BACKEND=ollama
export AILANG_MODEL=llama3.2
export AILANG_OUTPUT_DIR=dist

🔧 Configuration Reference

LLM Backends

Backend Description Setup
ollama Local Ollama server Install Ollama + pull model
llamacpp llama.cpp server Run llama.cpp server on :8080
anthropic Claude API Set API key
openai GPT-4 API Set API key
custom Custom endpoint Configure URL

Available Settings

llm_backend          # ollama, anthropic, openai, llamacpp, custom
ollama_model         # Model name for Ollama
ollama_url           # Ollama server URL
anthropic_api_key    # Claude API key
openai_api_key       # OpenAI API key
custom_endpoint      # Custom LLM endpoint
default_language     # Default source language (en, es, ar, etc.)
output_dir           # Output directory (default: build)
auto_open            # Auto-open after compile (true/false)

🌍 Supported Languages

Language Code Example Extension
English en .en
Spanish es .es
Arabic ar .ar
French fr .fr
German de .de
Chinese zh .zh
Japanese ja .ja
Hindi hi .hi
Portuguese pt .pt
Russian ru .ru

Want your language? Request it here

🤝 Contributing

We welcome contributions! Here's how:

  1. Add language support - Submit translations
  2. Improve compilation - Better prompts, optimizations
  3. New targets - Mobile, desktop, embedded
  4. Examples - Share your AILang projects
  5. Documentation - Tutorials, guides

See CONTRIBUTING.md

📦 Ecosystem

IDE Support

  • VS Code Extension - Syntax highlighting, autocomplete
  • Sublime Text - Syntax highlighting
  • Vim Plugin - Syntax, compilation

Package Registry

Share and install AILang packages:

ailang install date-utils
ailang publish my-package

Community Examples

Browse examples: https://github.com/ailang-examples

🐛 Troubleshooting

"Compilation failed"

  1. Check LLM backend is running:
# For Ollama
ollama list
curl http://localhost:11434/api/tags
  1. Verify configuration:
ailang config get
  1. Test with simple code:
echo "Show hello world" > test.en
ailang compile test.en

"Ollama not found"

Install Ollama: https://ollama.ai

Or use cloud API:

ailang config set llm_backend anthropic

Slow compilation

Use a smaller model:

ollama pull llama3.2:7b  # Smaller, faster
ailang config set ollama_model llama3.2:7b

📄 License

MIT License - See LICENSE

🙏 Credits

🌟 Star Us!

If you like AILang, give us a star on GitHub! ⭐

📞 Support


Made with ❤️ by the AILang community

Programming should be as natural as speaking.

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

ailang_cli-1.0.3.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

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

ailang_cli-1.0.3-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file ailang_cli-1.0.3.tar.gz.

File metadata

  • Download URL: ailang_cli-1.0.3.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ailang_cli-1.0.3.tar.gz
Algorithm Hash digest
SHA256 3d8ad9a59b416fdeb6ee04334f6354528140dd910c54ee6f8b63f30fcbd7c2bc
MD5 67f11f63e361d5aa07b7debc82d6a6cb
BLAKE2b-256 909d15e76f428f75f6fbd47af1a9c1ffa8dc08fd17d20619deaf90b1a7896470

See more details on using hashes here.

File details

Details for the file ailang_cli-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: ailang_cli-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ailang_cli-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62b624879b80e3c73cf89c423793212a97d52c3016a211ac392d2250056c69df
MD5 4209e11821087a5a73203724b0b46300
BLAKE2b-256 1cadf800f379264c1c566dbef8775d17e3d202ee5497487e1eb0987a359c2ec3

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