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.4.0.tar.gz (106.8 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.4.0-py3-none-any.whl (94.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for alecci-1.4.0.tar.gz
Algorithm Hash digest
SHA256 9f97cf28f89048739e6b9062b825fe52e99e9e2adcdd97a62148f4bfc140b07e
MD5 192bad9d55e775eaa905ae65060fafff
BLAKE2b-256 f31bbd09909ca51b3b8b745b7ba6f736be167b4a6f71359a6cccdb593ca01b5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: alecci-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 94.9 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f280a3ea24b12121b9c900802e9888b327e7b3cdcfff4a8ef03d56723d0c11e
MD5 9f5320658e3ec514af241d594d015b0b
BLAKE2b-256 43d4c655ed6b9d66fb284ba6720ac637f65b2b9017444eed6cda3f4e54b63af2

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