Skip to main content

A compiler for the Alecci programming language

Project description

Alecci Programming Language

A modern programming language with built-in concurrency support, compiled to native code via LLVM.

Features

  • 🚀 High Performance: Compiles to optimized native code via LLVM
  • 🧵 Built-in Concurrency: Native threading, mutexes, barriers, and semaphores
  • 🔧 Modern Syntax: Clean, readable syntax with type inference
  • 🛡️ Memory Safety: Variant types and safe array operations
  • 🔄 Sanitizer Support: Built-in ThreadSanitizer for race conditions and AddressSanitizer for memory safety

Quick Start

Installation

pip install alecci --break-system-packages

Note: If the alecci command is not found after installation, you may need to add the user bin directory to your PATH:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Alternatively, you can run the compiler directly:

python3 -m alecci

Your First Program

Create a file called hello.ale:

procedure main(argc, argv)
    print("Hello, Alecci!")
end procedure

Compile and run:

alecci hello.ale -o hello
./hello

Sanitizer Options

  • Thread Sanitizer (default): Detects race conditions and threading issues

    alecci hello.ale -o hello  # TSan enabled by default
    
  • AddressSanitizer: Detects memory errors like buffer overflows

    alecci hello.ale --use-asan -o hello
    
  • No Sanitizer: Disable all sanitizers for maximum performance

    alecci hello.ale --no-tsan -o hello
    

Threading Example

procedure worker(thread_number as int)
    print `Worker {thread_number} is running`
end procedure

procedure main(argc, argv)
    shared const thread_count := 4
    
    mutable threads := create_threads(thread_count, worker)
    join_threads(threads)
    
    print("All workers completed!")
end procedure

Language Features

Variables and Types

mutable x := 42          // Mutable integer
const message := "Hello" // Immutable string
mutable arr := array(10, 0) // Array of 10 zeros

Functions

function add(a as int, b as int) -> int
    return a + b
end function

Concurrency

shared mutable counter := 0
shared mutable mtx := mutex()

procedure increment()
    lock(mtx)
    counter := counter + 1
    unlock(mtx)
end procedure

Installation from Source

If you want to build from source:

git clone https://github.com/yourusername/alecci.git
cd alecci
pip install -e . --break-system-packages

If needed, add the local bin directory to your PATH:

export PATH="$HOME/.local/bin:$PATH"

Requirements

  • Python 3.8+
  • LLVM 14+ (for llvmlite)
  • GCC or Clang (for linking)

Documentation

License

MIT License - see LICENSE file for details.

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

alecci-1.3.0.tar.gz (104.5 kB view details)

Uploaded Source

Built Distribution

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

alecci-1.3.0-py3-none-any.whl (95.5 kB view details)

Uploaded Python 3

File details

Details for the file alecci-1.3.0.tar.gz.

File metadata

  • Download URL: alecci-1.3.0.tar.gz
  • Upload date:
  • Size: 104.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for alecci-1.3.0.tar.gz
Algorithm Hash digest
SHA256 1d581e855af8c79da6d0266e3a5471b4f640f899030816bdca8a1c78a0b7d536
MD5 1c873d272a8ee617f475af9bbb8e672e
BLAKE2b-256 6885e92608edf37e4a73a71b444517ae8b283f4caf6f6926e29f1440c9b705ee

See more details on using hashes here.

File details

Details for the file alecci-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: alecci-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 95.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for alecci-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4995a69a6f746b5bb5d50ab0692fe4d74b7bbd1857177eab0dabc445bd78a379
MD5 59c30e0c00da5287d758b05107b2d496
BLAKE2b-256 59965a2b9429b0f49f4f3119bf07959fba2236c7d8b44c328104c6b2469f3866

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