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.0.0.tar.gz (85.9 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.0.0-py3-none-any.whl (82.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for alecci-1.0.0.tar.gz
Algorithm Hash digest
SHA256 30b32762583bc97fbf26fea05718ad6509a484c477634412e9c34ced27a2789f
MD5 42e37cd779cb03dc5580d7231bda515f
BLAKE2b-256 b61f72e820a02c632e89584b300c97a9a863066aee88efc387c6db10d0c56e2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: alecci-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 82.8 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09a7b60c03e0be66c6db555379edab9191be7f744e6f4f550fc7b16a4c03d0a9
MD5 d928aaaea632d1fb4ffadc98ece7c55f
BLAKE2b-256 843c7f14fc946a33f46a3b12e6aaf37d6cc617e0b41b822cfa35e213ac1d093a

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