Skip to main content

A compiler for the Alecci programming language

Project description

Alecci Programming Language

Alecci is a compiled programming language designed for teaching concurrent and parallel programming. It provides built-in primitives for threading, synchronization, and inter-thread communication, and compiles to native code via LLVM.

The language is used in operating systems and parallel programming courses to help students write, analyze, and debug concurrent programs without the overhead of a general-purpose systems language.

Installation

pip install alecci

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

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

You can also invoke the compiler directly without installing the command:

python3 -m alecci

System Requirements

  • Python 3.8 or later
  • LLVM 14 or later (provided via llvmlite)
  • GCC or Clang for linking

Usage

alecci program.ale -o program
./program

Sanitizer options

ThreadSanitizer is enabled by default to detect data races at runtime:

alecci program.ale -o program          # ThreadSanitizer enabled (default)
alecci program.ale --no-tsan -o program  # Sanitizers disabled

Language Overview

Variables

mutable x := 42
const message := "Hello"
mutable arr := array(10, 0)

Procedures and functions

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

Threads

procedure worker(thread_number as int)
  print `Worker {thread_number} 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 done")
end procedure

Synchronization primitives

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

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

Available primitives: mutex, semaphore, barrier, queue, thread.

Concurrency Validation

The package includes a test suite (concurrency_validation/) with annotated example programs covering common concurrency patterns and bugs, including data races, deadlocks, and thread leaks. These are used to evaluate ThreadSanitizer detection rates.

Source

Source code is available at github.com/citic/alecci.

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.1.tar.gz (106.3 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.1-py3-none-any.whl (94.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alecci-1.4.1.tar.gz
  • Upload date:
  • Size: 106.3 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.1.tar.gz
Algorithm Hash digest
SHA256 8091c0af979ba6a8e1e15c3856d6c593f7802ad83931be9b750fa998a05377ef
MD5 255cec001eef9ca46d1d5c0699e489d9
BLAKE2b-256 59c43811c1107ca03d95a7d5f7f92c5cdfec1d03daec33f1d46a3f1c78d527e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: alecci-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 94.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85480a88f14045b7b26e298a8abda41e0d4e68bb798bfd5c6947c0737cb70f1a
MD5 6f9a65edeb95be3267da1cf2f0f4cb86
BLAKE2b-256 02afe738662327b8f331beab9815448aea4604bf54136b775051d1c7daf57760

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