Sona Programming Language with Cognitive Accessibility and Neurodivergent-First Features
Project description
๐ต Sona v0.10.1
AI-Native Programming Language with 91-Module Standard Library
Sona is a modern, expressive programming language designed for rapid development with built-in AI capabilities. Perfect for automation, data processing, web services, and AI-assisted applications.
What's New in v0.10.1
- Cognitive Preview โ intent, decision provenance, trace, and cognitive scopes.
- Cognitive reports โ exportable report artifacts and linting (runtime + LSP).
- Profile annotations โ ADHD/dyslexia profile metadata surfaced in the editor.
- Version sync โ packaging/runtime/docs aligned on v0.10.1.
Cognitive Features
Example 1: Intent anchors
@intent "parse user config safely";
Example 2: Focus blocks with validation
import json;
func validate(cfg) {
return cfg;
}
@intent "parse user config safely";
focus {
let cfg = json.parse(text);
validate(cfg);
}
Example 3: Explainable checkpoints
cognitive_trace(enabled=true);
explain_step(note="checkpoint before export");
Note: Each @intent is recorded as an intent entry in cognitive reports.
๐ Quick Start
Installation
# 1. Clone or download
git clone https://github.com/Bryantad/Sona.git
cd Sona
# 2. Create virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1 # Windows
# source .venv/bin/activate # Linux/macOS
# 3. Install dependencies
pip install -r requirements.txt
# 4. Install Sona
pip install -e .
Your First Program
Create hello.sona:
// Simple greeting
print("Hello from Sona v0.10.1!");
// Use stdlib
import json;
let data = {"version": "0.10.1", "modules": 91};
print(json.stringify(data));
Run it:
python run_sona.py hello.sona
๐ฏ Core Features
โ All Tier 1 Features (Production Ready)
| Feature | Description | Status |
|---|---|---|
| Variables | let x = 10; const PI = 3.14; |
โ |
| Functions | func add(a, b) { return a + b; } |
โ |
| Control Flow | if, when, match, while, for |
โ |
| Loop Control | break, continue, repeat |
โ |
| Collections | Lists, Dicts, Sets, Tuples | โ |
| Destructuring | let [a, b] = [1, 2]; |
โ |
| Error Handling | try/catch blocks |
โ |
| Modules | import json; export func; |
โ |
| Classes | OOP with inheritance | โ |
| Operators | Arithmetic, logical, comparison | โ |
๐ฆ Standard Library (91 Modules)
๐ต Core System (7 modules)
import json; // JSON parsing/serialization
import math; // Mathematical operations
import string; // String manipulation
import regex; // Regular expressions
import boolean; // Boolean utilities
import type; // Type checking
import comparison; // Comparison utilities
๐ Data Structures (7 modules)
import collection; // Collections namespace
import queue; // Queue operations
import stack; // Stack operations
import graph; // Graph algorithms
import tree; // Tree structures
import heap; // Min/Max heaps
import matrix; // 2D matrices
๐ I/O & Formats (8 modules)
import fs; // File system operations
import path; // Path manipulation
import io; // Input/output
import csv; // CSV processing
import yaml; // YAML serialization
import toml; // TOML configuration
import compression; // Gzip/zip compression
import xml; // XML parsing/building
๐ Network & Web (9 modules)
import http; // HTTP client
import url; // URL parsing/building
import cookies; // Cookie management
import session; // HTTP sessions
import websocket; // WebSocket client
import dns; // DNS resolution
import smtp; // Email sending
import proxy; // HTTP proxy
import ftp; // FTP client
import oauth; // OAuth2 flows
๐พ Database & Storage (6 modules)
import sqlite; // SQLite database
import cache; // In-memory cache
import redis; // Redis client
import orm; // Simple ORM
import query; // SQL query builder
import migration; // Database migrations
๐ Security & Auth (6 modules)
import jwt; // JWT tokens
import crypto; // Cryptographic hashing
import password; // Password hashing
import hashing; // General hashing
import secrets; // Secure random
import permissions; // RBAC system
โก Async & Concurrency (5 modules)
import async; // Async utilities
import thread; // Threading
import process; // Process management
import pool; // Thread/process pools
import promise; // Promise/Future pattern
๐งช Testing & Quality (5 modules)
import test; // Test framework
import assert; // Assertions
import mock; // Mock objects
import benchmark; // Performance testing
import profiler; // Code profiling
๐ ๏ธ Utilities (13 modules)
import env; // Environment variables
import date; // Date operations
import time; // Time operations
import timer; // Timer utilities
import random; // Random generation
import encoding; // Base64/URL encoding
import uuid; // UUID generation
import validation; // Input validation
import statistics; // Statistical functions
import sort; // Sorting algorithms
import search; // Search algorithms
import numbers; // Number utilities
import operators; // Operator utilities
๐ค Automation (7 modules)
import cli; // CLI argument parsing
import logging; // Logging system
import config; // Configuration management
import scheduler; // Task scheduling
import signal; // Event system
import shell; // Shell commands
import bitwise; // Bitwise operations
๐ง Functional Programming (4 modules)
import functional; // Composition, currying
import decorator; // Common decorators
import iterator; // Iterator utilities
import color; // Color manipulation
๐ Templates & Processing (3 modules)
import template; // Template engine
import markdown; // Markdown to HTML
import xml; // XML processing
๐ก Code Examples
Web Scraping with Sessions
import session;
import json;
// Create HTTP session
let s = session.create();
s.set_header("User-Agent", "Sona/0.10.1");
// Make requests
let response = s.get("https://api.example.com/data");
let data = json.parse(response.body);
print("Fetched " + data.length + " items");
Database Operations
import sqlite;
import orm;
// Connect to database
let db = sqlite.connect("app.db");
db.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)");
// Insert data
db.insert("users", {"name": "Alice", "email": "alice@example.com"});
db.insert("users", {"name": "Bob", "email": "bob@example.com"});
// Query
let users = db.query("SELECT * FROM users WHERE name LIKE ?", ["A%"]);
for user in users {
print(user.name + ": " + user.email);
}
JWT Authentication
import jwt;
import password;
// Hash password
let hashed = password.hash("secretpassword");
print("Hashed: " + hashed);
// Create JWT token
let payload = {
"user_id": 123,
"username": "alice",
"role": "admin"
};
let token = jwt.encode(payload, "my-secret-key", exp_minutes=60);
print("Token: " + token);
// Verify token
let decoded = jwt.decode(token, "my-secret-key");
print("User ID: " + decoded.user_id);
Graph Algorithms
import graph;
// Create graph
let g = graph.create();
g.add_edge("A", "B");
g.add_edge("B", "C");
g.add_edge("A", "C");
g.add_edge("C", "D");
// Find shortest path
let path = g.shortest_path("A", "D");
print("Path: " + path.join(" -> ")); // A -> C -> D
// Check for cycles
let has_cycle = g.has_cycle();
print("Has cycle: " + has_cycle);
Testing with Assertions
import test;
import assert;
// Create test suite
let suite = test.suite("Math Tests");
suite.add_test("addition", func() {
let result = 2 + 2;
assert.equal(result, 4);
});
suite.add_test("division", func() {
let result = 10 / 2;
assert.equal(result, 5);
});
// Run tests
let results = suite.run();
print("Passed: " + results.passed + "/" + results.total);
Template Rendering
import template;
// Create template
let tmpl = "Hello {{name}}, you have {{count}} messages.";
// Render
let output = template.render(tmpl, {
"name": "Alice",
"count": 5
});
print(output); // Hello Alice, you have 5 messages.
Functional Programming
import functional;
// Function composition
let add_one = func(x) { return x + 1; };
let double = func(x) { return x * 2; };
let f = functional.pipe(add_one, double);
let result = f(5); // (5 + 1) * 2 = 12
print("Result: " + result);
// Currying
let multiply = func(a, b) { return a * b; };
let triple = functional.curry(multiply)(3);
print("Triple 7: " + triple(7)); // 21
๐ Documentation
- Quick Start Guide - Get up and running in 5 minutes
- API Reference - Complete API documentation
- Release Notes - What's new in v0.10.1
- Examples - Sample projects and code snippets
โ Verification
Run the comprehensive test suite:
# PowerShell
.\run_all_tests.ps1
# Or run test file directly
python run_sona.py test_all_097.sona
Expected output:
โ
ALL 91 MODULES VERIFIED SUCCESSFULLY!
Module Categories:
โข Core System: 7 modules
โข Data Structures: 7 modules
โข I/O & Formats: 8 modules
โข Network & Web: 9 modules
โข Database: 6 modules
โข Security: 6 modules
โข Async: 5 modules
โข Testing: 5 modules
โข Utilities: 13 modules
โข Automation: 7 modules
โข Functional: 4 modules
โข Templates: 3 modules
โโโโโโโโโโโโ
TOTAL: 91 modules
๐๏ธ Architecture
Zero Dependencies
Sona's standard library has zero external dependencies. Everything is built on Python's standard library, ensuring:
- โ Fast installation
- โ No version conflicts
- โ Maximum stability
- โ Easy deployment
Module Design
Each module follows consistent patterns:
# Comprehensive docstrings
def function(param: type) -> type:
"""
Description of what function does.
Args:
param: Description of parameter
Returns:
Description of return value
Example:
>>> result = function(value)
>>> print(result)
"""
# Implementation
pass
Category Organization
Modules are organized into 12 logical categories:
- Core System - Fundamental operations
- Data Structures - Collections and algorithms
- I/O & Formats - File and format handling
- Network & Web - HTTP, WebSocket, DNS, etc.
- Database & Storage - Data persistence
- Security & Auth - Cryptography and authentication
- Async & Concurrency - Parallel execution
- Testing & Quality - Test and debug tools
- Utilities - Common helper functions
- Automation - CLI, logging, scheduling
- Functional Programming - FP patterns
- Templates & Processing - Text processing
๐ฃ๏ธ Roadmap
v0.10.x (Cognitive Preview)
- Cognitive report schema stabilization
- LSP cognitive diagnostics depth
- Export workflow integrations
- Runtime coverage consistency
v1.0.0 (Target: Q2 2024)
- Production-grade stability
- Comprehensive test coverage
- Package manager (npm-like)
- VS Code extension
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Areas for Contribution
- ๐ Documentation improvements
- ๐งช Additional test cases
- ๐ Bug fixes
- โจ New module proposals
- ๐ Internationalization
๐ License
Sona is released under the MIT License. See LICENSE file for details.
๐ Acknowledgments
Built with โค๏ธ using:
- Python - Core runtime
- Lark - Parser generator
- Community feedback - Feature requests and bug reports
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: docs/
Sona v0.10.1 - 91 Modules, Zero Dependencies, Infinite Possibilities
Made with ๐ต by the Sona Team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sona_lang-0.12.0.tar.gz.
File metadata
- Download URL: sona_lang-0.12.0.tar.gz
- Upload date:
- Size: 515.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c86450586c98adaad6d2818a6d5fc883ffc1f789e408a7c09ef7e6bf2206b3e2
|
|
| MD5 |
c83042583e91df81c07046b7d9bf8408
|
|
| BLAKE2b-256 |
270a4ec8d5dfeafd17a0775a6e566ebb24dc6b4b8dd75c484c6ac4f433de3c82
|
File details
Details for the file sona_lang-0.12.0-py3-none-any.whl.
File metadata
- Download URL: sona_lang-0.12.0-py3-none-any.whl
- Upload date:
- Size: 582.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bb615f0e9989e97e379f89ef16df7e741fecb71e65abdd1a8bda4cc91378fc9
|
|
| MD5 |
fb703c6c88131a234c98975722dd8d91
|
|
| BLAKE2b-256 |
ce25a7bf1dbdb5314f0f85ce4daceda29d9b0c940b7c7722f292f75cc72b750b
|