diff --git a/README.md b/README.md index 6583063..3afec8a 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,34 @@ -# 🌟 AiraLang (v1.4.2 Aira Cyber & AI Edition) +# 🌟 AiraLang (v1.4.4 Cross-Platform & System Edition) > **The High-Performance, Expressive & Modular Scripting Language for Creators, AI & Cybersecurity Engineers** > **Author & Creator:** Adam Eehan (Founder & CEO, Aira Group of Technology) 👑 --- ## ⚡ Introduction -`AiraLang` is an open-source, dynamic, and expressive scripting language engineered from scratch with a focus on simplicity, developer freedom, high speed, native AI integrations, and advanced systems/cybersecurity capabilities. +`AiraLang` is an open-source, dynamic, and expressive scripting language engineered from scratch with a focus on simplicity, developer freedom, high speed, native AI integrations, cross-platform host telemetry, and advanced systems/cybersecurity capabilities. Runs natively across **Linux, Termux, Windows, and macOS**. --- -## 🚀 Quick Start in Termux / Linux +## 🚀 Quick Start -### 1. Interactive REPL Shell -```bash -airalang -``` +### 🪟 Windows Setup +1. Run `install.bat` (or add `Airalang\bin` to your User PATH). +2. Execute directly in Command Prompt or PowerShell: + ```cmd + airalang script.aira + ``` -### 2. Run an AiraLang Script -```bash -airalang script.aira -# or: airalang run script.aira -``` +### 🐧 Termux / Linux Setup +1. Run `./install.sh` +2. Interactive REPL: + ```bash + airalang + ``` +3. Run an AiraLang Script: + ```bash + airalang script.aira + # or: airalang run script.aira + ``` ### 3. Compile Script to Standalone Executable Binary ```bash diff --git a/bin/airalang b/bin/airalang index b894f52..6f03af9 100755 --- a/bin/airalang +++ b/bin/airalang @@ -1,8 +1,15 @@ -#!/data/data/com.termux/files/usr/bin/python3 +#!/usr/bin/env python3 import sys import os -sys.path.insert(0, "/data/data/com.termux/files/home/airalang/src") +base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +src_dir = os.path.join(base_dir, "src") + +if os.path.isdir(src_dir): + sys.path.insert(0, src_dir) +elif os.path.isdir("/data/data/com.termux/files/home/airalang/src"): + sys.path.insert(0, "/data/data/com.termux/files/home/airalang/src") + import cli if __name__ == "__main__": diff --git a/bin/airalang.bat b/bin/airalang.bat new file mode 100644 index 0000000..08cbd24 --- /dev/null +++ b/bin/airalang.bat @@ -0,0 +1,2 @@ +@echo off +python "%~dp0..\src\cli.py" %* diff --git a/examples/test_v144_features.aira b/examples/test_v144_features.aira new file mode 100644 index 0000000..359b96d --- /dev/null +++ b/examples/test_v144_features.aira @@ -0,0 +1,23 @@ +import "system"; +import "os"; + +say "========================================"; +say "⚡ AiraLang v1.4.4 Feature Verification"; +say "========================================"; + +let info = system.info(); +say "💻 Platform: " + info.platform; +say "🧠 CPU: " + info.cpu.name + " (" + info.cpu.cores + " Cores)"; +say "💾 RAM: " + info.ram.used_gb + " GB / " + info.ram.total_gb + " GB (" + info.ram.percent_used + "% used)"; +say "🎮 GPU: " + info.gpu.name; +if (info.gpu.total_vram_mb > 0) { + say " VRAM: " + info.gpu.total_vram_mb + " MB | Driver: " + info.gpu.driver_version; +} +say "🔋 Battery: " + info.battery.percentage + "% (" + info.battery.power_source + ")"; + +say ""; +say "📁 OS Checks:"; +say " Is Windows: " + os.is_windows(); +say " Is Linux: " + os.is_linux(); +say " CLI Args: " + os.args(); +say "========================================"; diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..5e7fbc0 --- /dev/null +++ b/install.bat @@ -0,0 +1,18 @@ +@echo off +setlocal +echo =================================================== +echo AiraLang Windows Installer +echo Creator: Adam Eehan (Aira Group of Technology) +echo =================================================== +echo. + +set "BIN_DIR=%~dp0bin" + +echo [+] Adding %BIN_DIR% to User PATH... +powershell -Command "$p = [Environment]::GetEnvironmentVariable('Path', 'User'); if ($p -notlike '*%BIN_DIR%*') { [Environment]::SetEnvironmentVariable('Path', $p + ';%BIN_DIR%', 'User'); Write-Host '[+] Successfully added to User PATH!' } else { Write-Host '[*] Already in PATH.' }" + +echo. +echo [+] Installation complete! Open a new command prompt and run: +echo airalang --version +echo =================================================== +pause diff --git a/modules/README.md b/modules/README.md index 363990a..1f07255 100644 --- a/modules/README.md +++ b/modules/README.md @@ -1,11 +1,11 @@ # 📦 AiraLang Standard Library Modules Directory -> **Official Module Catalog for AiraLang (v1.4.1 Aira Cyber & AI Edition)** +> **Official Module Catalog for AiraLang (v1.4.4 Cross-Platform & System Edition)** > **Author & Creator:** Adam Eehan (Founder & CEO, Aira Group of Technology) 👑 --- ## 🌟 Overview -AiraLang features 15 built-in standard library modules engineered natively for speed, AI capabilities, cyber security recon, system operations, and developer joy. +AiraLang features 16 built-in standard library modules engineered natively for speed, AI capabilities, cyber security recon, system operations, and developer joy. All modules are loaded natively via the `import` statement: ```aira @@ -19,20 +19,21 @@ import ""; | # | Module | Category | Primary Purpose | Key Methods | |---|---|---|---|---| | 1 | [`ai`](./ai.md) | Artificial Intelligence | Universal LLM engine (OpenAI, DeepSeek, Claude, Gemini, Groq, Ollama, OpenRouter, etc.) | `ask()`, `set_provider()`, `set_endpoint()`, `set_key()`, `providers()` | -| 2 | [`android`](./android.md) / `droidsec` | Mobile Security & Recon | Android device integrity audit, root detection, and static APK security analyzer | `device_info()`, `audit_device()`, `audit_apk()`, `audit_package()`, `check_root()` | -| 3 | [`sec`](./sec.md) | Cybersecurity | Port scanning, header auditing, subdomain discovery | `scan_ports()`, `audit_headers()`, `subdomains()`, `crack_md5()` | -| 4 | [`proposal`](./proposal.md) | Fun & Cyber-Prank | Automated HTTP 500 love timeout & AI sentiment checker | `ask()`, `set_key()`, `set_system()`, `wish()`, `set_wish()` | -| 5 | [`http`](./http.md) | Networking | Web requests, REST APIs, and file downloads | `get()`, `post()`, `download()`, `status()` | -| 6 | [`file`](./file.md) | System I/O | Read, write, append, and inspect local files | `read()`, `write()`, `append()`, `exists()`, `delete()` | -| 7 | [`os`](./os.md) | System | Shell commands, environment variables, directories | `cmd()`, `env()`, `cwd()`, `listdir()`, `mkdir()`, `platform()` | -| 8 | [`math`](./math.md) | Mathematics | Math functions, trigonometry, and constants | `sqrt()`, `pow()`, `abs()`, `random()`, `round()`, `pi`, `e` | -| 9 | [`time`](./time.md) | System | Epoch time, timestamps, and execution delays | `now()`, `time()`, `sleep()` | -| 10 | [`json`](./json.md) | Data | Parsing and serialization of JSON payloads | `parse()`, `stringify()`, `mkstring()` | -| 11 | [`crypto`](./crypto.md) | Security | Cryptographic hashes and encoding utilities | `md5()`, `sha256()`, `sha1()`, `base64_encode()`, `base64_decode()` | -| 12 | [`string`](./string.md) | Utilities | Advanced text manipulation and transformation | `split()`, `replace()`, `upper()`, `lower()`, `trim()`, `join()` | -| 13 | [`sqlite`](./sqlite.md) | Database | Lightweight embedded SQL relational database | `open()`, `query()`, `execute()`, `close()` | -| 14 | [`net`](./net.md) | Networking | Host pings, TCP port checks, and IP discovery | `ping()`, `port_open()`, `local_ip()`, `fetch()` | -| 15 | [`thread`](./thread.md) | Concurrency | Thread spawning, worker pools, and parallel execution | `spawn()`, `join()`, `pool()`, `sleep()` | +| 2 | [`system`](./system.md) / `hardware` | PC & Hardware Telemetry | Cross-platform GPU, CPU, RAM, battery, and OS hardware telemetry | `info()`, `gpu()`, `battery()`, `ram()`, `cpu()` | +| 3 | [`android`](./android.md) / `droidsec` | Mobile Security & Recon | Android device integrity audit, root detection, and static APK security analyzer | `device_info()`, `audit_device()`, `audit_apk()`, `audit_package()`, `check_root()` | +| 4 | [`sec`](./sec.md) | Cybersecurity | Port scanning, header auditing, subdomain discovery | `scan_ports()`, `audit_headers()`, `subdomains()`, `crack_md5()` | +| 5 | [`proposal`](./proposal.md) | Fun & Cyber-Prank | Automated HTTP 500 love timeout & AI sentiment checker | `ask()`, `set_key()`, `set_system()`, `wish()`, `set_wish()` | +| 6 | [`http`](./http.md) | Networking | Web requests, REST APIs, and file downloads | `get()`, `post()`, `download()`, `status()` | +| 7 | [`file`](./file.md) | System I/O | Read, write, append, and inspect local files | `read()`, `write()`, `append()`, `exists()`, `delete()` | +| 8 | [`os`](./os.md) | System | Shell commands, environment variables, CLI args, directories | `cmd()`, `env()`, `cwd()`, `listdir()`, `mkdir()`, `args()`, `is_windows()` | +| 9 | [`math`](./math.md) | Mathematics | Math functions, trigonometry, and constants | `sqrt()`, `pow()`, `abs()`, `random()`, `round()`, `pi`, `e` | +| 10 | [`time`](./time.md) | System | Epoch time, timestamps, and execution delays | `now()`, `time()`, `sleep()` | +| 11 | [`json`](./json.md) | Data | Parsing and serialization of JSON payloads | `parse()`, `stringify()`, `mkstring()` | +| 12 | [`crypto`](./crypto.md) | Security | Cryptographic hashes and encoding utilities | `md5()`, `sha256()`, `sha1()`, `base64_encode()`, `base64_decode()` | +| 13 | [`string`](./string.md) | Utilities | Advanced text manipulation and transformation | `split()`, `replace()`, `upper()`, `lower()`, `trim()`, `join()` | +| 14 | [`sqlite`](./sqlite.md) | Database | Lightweight embedded SQL relational database | `open()`, `query()`, `execute()`, `close()` | +| 15 | [`net`](./net.md) | Networking | Host pings, TCP port checks, and IP discovery | `ping()`, `port_open()`, `local_ip()`, `fetch()` | +| 16 | [`thread`](./thread.md) | Concurrency | Thread spawning, worker pools, and parallel execution | `spawn()`, `join()`, `pool()`, `sleep()` | --- *Maintained by the AiraLang Core Engineering Team. Created by Adam Eehan.* diff --git a/modules/system.md b/modules/system.md new file mode 100644 index 0000000..98b6228 --- /dev/null +++ b/modules/system.md @@ -0,0 +1,93 @@ +# 💻 `system` Module (AiraLang Cross-Platform Hardware & OS) + +Native cross-platform system diagnostic, hardware telemetry, and host environment inspection module. Companion module to `android`, designed for PC, Laptop, and Server environments (Windows, Linux, and Termux). + +Can be imported as either: +```aira +import "system"; +# or +import "hardware"; +``` + +--- + +## 🛠️ Functions & Capabilities + +### 1. `system.info()` +Returns comprehensive hardware and operating system telemetry in a unified dictionary: +- `platform`: Host OS platform identifier (`win32`, `linux`, etc.) +- `cpu`: CPU details (name, core count, architecture) +- `ram`: System memory metrics (total GB, available GB, used GB, percent used) +- `gpu`: GPU profile (NVIDIA model, VRAM total, free VRAM, driver version, status) +- `battery`: Power source and battery percentage + +```aira +import "system"; +let info = system.info(); +say "Platform: " + info.platform; +say "CPU: " + info.cpu.name; +say "RAM: " + info.ram.total_gb + " GB"; +``` + +--- + +### 2. `system.gpu()` +Detects dedicated and integrated graphics processing units, querying NVIDIA SMI on modern GPUs (e.g. RTX 3050, 4060, etc.): +- `name`: Full GPU brand and model +- `total_vram_mb`: Total video memory in Megabytes +- `free_vram_mb`: Available free VRAM +- `driver_version`: Installed NVIDIA driver version +- `temperature_c`: Current GPU die temperature in Celsius +- `status`: `"active"` or `"integrated_or_unavailable"` + +```aira +import "system"; +let gpu = system.gpu(); +say "GPU Model: " + gpu.name; +if (gpu.total_vram_mb > 0) { + say "VRAM: " + gpu.total_vram_mb + " MB"; +} +``` + +--- + +### 3. `system.battery()` +Inspects battery and charging status via native Windows Kernel32 / Linux power supply APIs: +- `percentage`: Battery state of charge (0 - 100%) +- `is_charging`: Boolean whether power is connected +- `power_source`: Detailed power source status + +```aira +import "system"; +let bat = system.battery(); +say "Battery: " + bat.percentage + "% | Charging: " + bat.is_charging; +``` + +--- + +### 4. `system.ram()` +Queries live RAM memory allocation: +- `total_gb`: Total physical RAM +- `available_gb`: Available free memory +- `used_gb`: Currently utilized memory +- `percent_used`: Memory load percentage (0 - 100) + +```aira +import "system"; +let mem = system.ram(); +say "RAM: " + mem.used_gb + " / " + mem.total_gb + " GB (" + mem.percent_used + "% used)"; +``` + +--- + +### 5. `system.cpu()` +Queries CPU architecture, core topology, and model identifier: +- `cores`: Logical core count +- `name`: Processor identifier string +- `architecture`: Machine architecture + +```aira +import "system"; +let cpu = system.cpu(); +say "CPU: " + cpu.name + " (" + cpu.cores + " Cores)"; +``` diff --git a/src/cli.py b/src/cli.py index 4626e38..574e0ac 100755 --- a/src/cli.py +++ b/src/cli.py @@ -1,14 +1,29 @@ -#!/data/data/com.termux/files/usr/bin/python3 import sys import os +# Cross-platform UTF-8 Console and ANSI Color configuration +if sys.platform == "win32": + try: + sys.stdout.reconfigure(encoding="utf-8", errors="replace") + sys.stderr.reconfigure(encoding="utf-8", errors="replace") + sys.stdin.reconfigure(encoding="utf-8", errors="replace") + import ctypes + kernel32 = ctypes.windll.kernel32 + hStdOut = kernel32.GetStdHandle(-11) + mode = ctypes.c_ulong() + kernel32.GetConsoleMode(hStdOut, ctypes.byref(mode)) + mode.value |= 0x0004 + kernel32.SetConsoleMode(hStdOut, mode) + except Exception: + pass + sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from lexer import Lexer from parser import Parser from evaluator import Evaluator -VERSION = "1.4.3 (Aira Cyber & Android Edition)" +VERSION = "1.4.4 (Cross-Platform & System Edition)" AUTHOR = "Adam Eehan (Aira Group of Technology)" ASCII_BANNER = f"""\033[1;36m @@ -21,7 +36,7 @@ ASCII_BANNER = f"""\033[1;36m \033[0m\033[1;30m---------------------------------------------------\033[0m \033[1;32m[+]\033[0m \033[1;37mEngine:\033[0m AiraLang v{VERSION} \033[1;34m[*]\033[0m \033[1;37mCreator:\033[0m {AUTHOR} - \033[1;35m[⚡]\033[0m \033[1;37mModules:\033[0m android, ai, sec, thread, sqlite, net, crypto + \033[1;35m[⚡]\033[0m \033[1;37mModules:\033[0m system, android, ai, sec, sqlite, net, crypto \033[1;33m[!]\033[0m Multiline support: open \033[1;32m{{\033[0m will continue on next line. \033[1;33m[!]\033[0m Type \033[1;31m'exit'\033[0m or \033[1;31m'quit'\033[0m to close REPL. \033[1;30m---------------------------------------------------\033[0m diff --git a/src/stdlib_modules.py b/src/stdlib_modules.py index 9fe4ddf..dbc6782 100644 --- a/src/stdlib_modules.py +++ b/src/stdlib_modules.py @@ -199,6 +199,19 @@ def create_os_module(): os.makedirs(path, exist_ok=True) return True + def get_args(): + if len(sys.argv) > 1: + raw = sys.argv[1:] + while raw and raw[0] in ("run", "build", "new", "-v", "--version", "-h", "--help"): + raw = raw[1:] + if raw and (raw[0].endswith(".aira") or raw[0].endswith(".py") or "airalang" in raw[0] or "cli.py" in raw[0]): + raw = raw[1:] + return raw + return [] + + def exit_app(code=0): + sys.exit(int(code)) + return AiraModule("os", { "cmd": cmd, "system": cmd, @@ -208,7 +221,13 @@ def create_os_module(): "cwd": cwd, "getcwd": cwd, "listdir": listdir, - "mkdir": mkdir + "mkdir": mkdir, + "args": get_args, + "argv": get_args, + "exit": exit_app, + "is_windows": lambda: sys.platform == "win32", + "is_android": lambda: "android" in sys.platform.lower() or os.path.exists("/data/data/com.termux"), + "is_linux": lambda: sys.platform.startswith("linux") and not os.path.exists("/data/data/com.termux") }) def create_math_module(): @@ -1388,6 +1407,157 @@ def create_android_module(): "get_prop": get_prop }) +def create_system_module(): + def get_gpu(): + try: + p = subprocess.run( + ["nvidia-smi", "--query-gpu=name,memory.total,memory.free,driver_version,temperature.gpu", "--format=csv,noheader,nounits"], + capture_output=True, text=True, timeout=3 + ) + if p.returncode == 0 and p.stdout.strip(): + parts = [x.strip() for x in p.stdout.strip().split(",")] + if len(parts) >= 5: + return { + "name": parts[0], + "total_vram_mb": int(parts[1]), + "free_vram_mb": int(parts[2]), + "driver_version": parts[3], + "temperature_c": int(parts[4]), + "status": "active" + } + except Exception: + pass + return { + "name": "Standard / Integrated Graphics", + "status": "integrated_or_unavailable", + "total_vram_mb": 0 + } + + def get_battery(): + if sys.platform == "win32": + try: + import ctypes + class SYSTEM_POWER_STATUS(ctypes.Structure): + _fields_ = [ + ('ac', ctypes.c_byte), + ('bf', ctypes.c_byte), + ('pct', ctypes.c_byte), + ('r', ctypes.c_byte), + ('lt', ctypes.c_ulong), + ('flt', ctypes.c_ulong), + ] + s = SYSTEM_POWER_STATUS() + if ctypes.windll.kernel32.GetSystemPowerStatus(ctypes.byref(s)): + return { + "percentage": int(s.pct) if s.pct <= 100 else 100, + "is_charging": bool(s.ac == 1), + "power_source": "AC (Charger Plugged In)" if s.ac == 1 else "Battery" + } + except Exception: + pass + for path in ["/sys/class/power_supply/battery", "/sys/class/power_supply/BAT0"]: + cap_file = os.path.join(path, "capacity") + status_file = os.path.join(path, "status") + if os.path.exists(cap_file): + try: + with open(cap_file) as f: + cap = int(f.read().strip()) + stat = "Discharging" + if os.path.exists(status_file): + with open(status_file) as f: + stat = f.read().strip() + return { + "percentage": cap, + "is_charging": stat.lower() == "charging", + "power_source": stat + } + except Exception: + pass + return {"percentage": 100, "is_charging": True, "power_source": "AC / Desktop"} + + def get_ram(): + if sys.platform == "win32": + try: + import ctypes + class MEMORYSTATUSEX(ctypes.Structure): + _fields_ = [ + ('dwLength', ctypes.c_ulong), + ('dwMemoryLoad', ctypes.c_ulong), + ('ullTotalPhys', ctypes.c_ulonglong), + ('ullAvailPhys', ctypes.c_ulonglong), + ('ullTotalPageFile', ctypes.c_ulonglong), + ('ullAvailPageFile', ctypes.c_ulonglong), + ('ullTotalVirtual', ctypes.c_ulonglong), + ('ullAvailVirtual', ctypes.c_ulonglong), + ('sullAvailExtendedVirtual', ctypes.c_ulonglong), + ] + stat = MEMORYSTATUSEX() + stat.dwLength = ctypes.sizeof(MEMORYSTATUSEX) + if ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)): + total_gb = round(stat.ullTotalPhys / (1024 ** 3), 2) + avail_gb = round(stat.ullAvailPhys / (1024 ** 3), 2) + used_gb = round(total_gb - avail_gb, 2) + return { + "total_gb": total_gb, + "available_gb": avail_gb, + "used_gb": used_gb, + "percent_used": int(stat.dwMemoryLoad) + } + except Exception: + pass + try: + with open("/proc/meminfo") as f: + lines = f.readlines() + mem = {} + for l in lines: + parts = l.split(":") + if len(parts) == 2: + mem[parts[0].strip()] = int(parts[1].split()[0]) + total = round(mem.get("MemTotal", 0) / (1024 * 1024), 2) + avail = round(mem.get("MemAvailable", 0) / (1024 * 1024), 2) + return {"total_gb": total, "available_gb": avail, "used_gb": round(total - avail, 2), "percent_used": int(round(((total - avail) / total) * 100)) if total else 0} + except Exception: + return {"total_gb": 0, "available_gb": 0, "used_gb": 0, "percent_used": 0} + + def get_cpu(): + import multiprocessing + cores = multiprocessing.cpu_count() + cpu_name = "x86_64 Processor" + if sys.platform == "win32": + cpu_name = os.environ.get("PROCESSOR_IDENTIFIER", "x86_64 Processor") + else: + try: + with open("/proc/cpuinfo") as f: + for line in f: + if "model name" in line: + cpu_name = line.split(":")[1].strip() + break + except Exception: + pass + return { + "cores": cores, + "architecture": sys.platform, + "name": cpu_name + } + + def get_info(): + return { + "platform": sys.platform, + "cpu": get_cpu(), + "ram": get_ram(), + "gpu": get_gpu(), + "battery": get_battery() + } + + return AiraModule("system", { + "info": get_info, + "device_info": get_info, + "gpu": get_gpu, + "battery": get_battery, + "ram": get_ram, + "cpu": get_cpu + }) + BUILTIN_MODULES = { "file": create_file_module, "os": create_os_module, @@ -1404,6 +1574,8 @@ BUILTIN_MODULES = { "thread": create_thread_module, "proposal": create_proposal_module, "android": create_android_module, - "droidsec": create_android_module + "droidsec": create_android_module, + "system": create_system_module, + "hardware": create_system_module } diff --git a/vscode-extension/README.md b/vscode-extension/README.md new file mode 100644 index 0000000..32f729b --- /dev/null +++ b/vscode-extension/README.md @@ -0,0 +1,13 @@ +# AiraLang Language Support for VS Code + +Official Visual Studio Code extension for **AiraLang** — the modern systems, AI, and cybersecurity programming language created by **Adam Eehan (Founder & CEO, Aira Group of Technology)**. + +## ✨ Features +* **Syntax Highlighting:** Complete token colorization for `.aira` files (`say`, `let`, `fn`, `import`, modules, operators, comments). +* **Language Configuration:** Auto-closing brackets, braces, strings, and `#` / `//` comment toggling. +* **Intelligent Snippets:** Instant scaffolding for `say`, `let`, `fn`, `import "ai"`, `import "system"`, and `import "android"`. + +## 🚀 How to Install +Place this folder inside your VS Code extensions folder: +- **Windows:** `%USERPROFILE%\.vscode\extensions\adameehan.airalang-1.0.0` +- **Linux / Mac:** `~/.vscode/extensions/adameehan.airalang-1.0.0` diff --git a/vscode-extension/language-configuration.json b/vscode-extension/language-configuration.json new file mode 100644 index 0000000..5597d38 --- /dev/null +++ b/vscode-extension/language-configuration.json @@ -0,0 +1,25 @@ +{ + "comments": { + "lineComment": "#", + "blockComment": ["/*", "*/"] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string", "comment"] } + ], + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ] +} diff --git a/vscode-extension/package.json b/vscode-extension/package.json new file mode 100644 index 0000000..06ca320 --- /dev/null +++ b/vscode-extension/package.json @@ -0,0 +1,46 @@ +{ + "name": "airalang", + "displayName": "AiraLang Language Support", + "description": "Rich language support, syntax highlighting, and code snippets for AiraLang.", + "version": "1.0.0", + "publisher": "adameehan", + "author": { + "name": "Adam Eehan (Aira Group of Technology)" + }, + "engines": { + "vscode": "^1.75.0" + }, + "categories": [ + "Programming Languages", + "Snippets" + ], + "keywords": [ + "airalang", + "aira", + "cyber", + "systems" + ], + "contributes": { + "languages": [ + { + "id": "airalang", + "aliases": ["AiraLang", "aira"], + "extensions": [".aira"], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "airalang", + "scopeName": "source.aira", + "path": "./syntaxes/airalang.tmLanguage.json" + } + ], + "snippets": [ + { + "language": "airalang", + "path": "./snippets/snippets.json" + } + ] + } +} diff --git a/vscode-extension/snippets/snippets.json b/vscode-extension/snippets/snippets.json new file mode 100644 index 0000000..594e7ad --- /dev/null +++ b/vscode-extension/snippets/snippets.json @@ -0,0 +1,78 @@ +{ + "Say Statement": { + "prefix": "say", + "body": [ + "say \"${1:Hello, World!}\";" + ], + "description": "Output text using AiraLang say statement" + }, + "Variable Declaration": { + "prefix": "let", + "body": [ + "let ${1:variable} = ${2:value};" + ], + "description": "Declare a new variable in AiraLang" + }, + "Function Definition": { + "prefix": "fn", + "body": [ + "fn ${1:name}(${2:params}) {", + "\t${3:// code here}", + "\treturn ${4:null};", + "}" + ], + "description": "Define a function in AiraLang" + }, + "If-Else Statement": { + "prefix": "ifelse", + "body": [ + "if (${1:condition}) {", + "\t${2:// true branch}", + "} else {", + "\t${3:// false branch}", + "}" + ], + "description": "If-Else condition in AiraLang" + }, + "Import AI Module": { + "prefix": "impai", + "body": [ + "import \"ai\";", + "ai.set_key(\"${1:YOUR_API_KEY}\");", + "let reply = ai.ask(\"${2:Hello, Aira!}\");", + "say reply;" + ], + "description": "Import and query AiraLang Universal AI module" + }, + "Import System Module": { + "prefix": "impsys", + "body": [ + "import \"system\";", + "let info = system.info();", + "say \"Platform: \" + info.platform;", + "say \"CPU: \" + info.cpu.name;", + "say \"GPU: \" + info.gpu.name;", + "say \"RAM: \" + info.ram.used_gb + \" / \" + info.ram.total_gb + \" GB\";" + ], + "description": "Import and inspect PC system and GPU metrics" + }, + "Import Android Module": { + "prefix": "impdroid", + "body": [ + "import \"android\";", + "let audit = android.audit_device();", + "say \"Device Posture: \" + audit.posture;", + "say \"Security Score: \" + audit.security_score + \"/100\";" + ], + "description": "Import and audit Android device security" + }, + "Proposal Prank Module": { + "prefix": "impprop", + "body": [ + "import \"proposal\";", + "proposal.ask(\"${1:Do you love me?}\");", + "say \"${2:Mee too!}\";" + ], + "description": "AiraLang Proposal prank timeout loop" + } +} diff --git a/vscode-extension/syntaxes/airalang.tmLanguage.json b/vscode-extension/syntaxes/airalang.tmLanguage.json new file mode 100644 index 0000000..cfb7277 --- /dev/null +++ b/vscode-extension/syntaxes/airalang.tmLanguage.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "AiraLang", + "scopeName": "source.aira", + "patterns": [ + { "include": "#comments" }, + { "include": "#strings" }, + { "include": "#numbers" }, + { "include": "#keywords" }, + { "include": "#builtins" }, + { "include": "#operators" }, + { "include": "#functions" } + ], + "repository": { + "comments": { + "patterns": [ + { + "name": "comment.line.number-sign.aira", + "match": "#.*$" + }, + { + "name": "comment.line.double-slash.aira", + "match": "//.*$" + }, + { + "name": "comment.block.aira", + "begin": "/\\*", + "end": "\\*/" + } + ] + }, + "strings": { + "patterns": [ + { + "name": "string.quoted.double.aira", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.aira", + "match": "\\\\." + } + ] + }, + { + "name": "string.quoted.single.aira", + "begin": "'", + "end": "'", + "patterns": [ + { + "name": "constant.character.escape.aira", + "match": "\\\\." + } + ] + } + ] + }, + "numbers": { + "patterns": [ + { + "name": "constant.numeric.aira", + "match": "\\b\\d+(\\.\\d+)?\\b" + } + ] + }, + "keywords": { + "patterns": [ + { + "name": "keyword.control.aira", + "match": "\\b(if|else|while|for|in|return|break|continue)\\b" + }, + { + "name": "keyword.declaration.aira", + "match": "\\b(let|fn|class|new|import)\\b" + }, + { + "name": "keyword.other.say.aira", + "match": "\\b(say)\\b" + }, + { + "name": "constant.language.aira", + "match": "\\b(true|false|null|this)\\b" + } + ] + }, + "builtins": { + "patterns": [ + { + "name": "support.class.module.aira", + "match": "\\b(system|hardware|android|droidsec|ai|sec|proposal|http|file|os|math|time|json|crypto|string|sqlite|net|thread)\\b" + } + ] + }, + "operators": { + "patterns": [ + { + "name": "keyword.operator.arithmetic.aira", + "match": "(\\+|\\-|\\*|\\/|\\%)" + }, + { + "name": "keyword.operator.comparison.aira", + "match": "(==|!=|≠|<=|>=|<|>)" + }, + { + "name": "keyword.operator.logical.aira", + "match": "(&&|\\|\\||!|\\band\\b|\\bor\\b|\\bnot\\b)" + }, + { + "name": "keyword.operator.assignment.aira", + "match": "(=)" + } + ] + }, + "functions": { + "patterns": [ + { + "name": "entity.name.function.aira", + "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()" + } + ] + } + } +}