Skip to main content

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

Version Python License

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.

See Full Release Notes


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


โœ… 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:

  1. Core System - Fundamental operations
  2. Data Structures - Collections and algorithms
  3. I/O & Formats - File and format handling
  4. Network & Web - HTTP, WebSocket, DNS, etc.
  5. Database & Storage - Data persistence
  6. Security & Auth - Cryptography and authentication
  7. Async & Concurrency - Parallel execution
  8. Testing & Quality - Test and debug tools
  9. Utilities - Common helper functions
  10. Automation - CLI, logging, scheduling
  11. Functional Programming - FP patterns
  12. 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


Sona v0.10.1 - 91 Modules, Zero Dependencies, Infinite Possibilities

Made with ๐ŸŽต by the Sona Team

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

sona_lang-0.12.0.tar.gz (515.8 kB view details)

Uploaded Source

Built Distribution

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

sona_lang-0.12.0-py3-none-any.whl (582.5 kB view details)

Uploaded Python 3

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

Hashes for sona_lang-0.12.0.tar.gz
Algorithm Hash digest
SHA256 c86450586c98adaad6d2818a6d5fc883ffc1f789e408a7c09ef7e6bf2206b3e2
MD5 c83042583e91df81c07046b7d9bf8408
BLAKE2b-256 270a4ec8d5dfeafd17a0775a6e566ebb24dc6b4b8dd75c484c6ac4f433de3c82

See more details on using hashes here.

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

Hashes for sona_lang-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bb615f0e9989e97e379f89ef16df7e741fecb71e65abdd1a8bda4cc91378fc9
MD5 fb703c6c88131a234c98975722dd8d91
BLAKE2b-256 ce25a7bf1dbdb5314f0f85ce4daceda29d9b0c940b7c7722f292f75cc72b750b

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