Scar – A programming language for easy concurrency and parallelism

1 death_eternal 1 8/5/2025, 12:45:47 PM scarlang.pages.dev ↗

Comments (1)

death_eternal · 3m ago
Repo: https://github.com/navid-m/scar

Because of the relatively poor state of multithreading in Nim and the reliance on external libraries like Arraymancer for heavy numerical workloads (also the performance issues with boxed values due to `ref object` everywhere), I started writing a language from scratch, with built-in support for concurrency via parallel blocks (without macros) and a C backend, similar to Nim.

GC is optional and the stdlib will work with or without the GC.

Example:

    int glob_value = 0
    float glob_value_2 = 0.0

    parallel:
        glob_value = some_heavy_task()
        glob_value_2 = some_other_heavy_task()

The idea is to make things like accessing shared memory concurrently a trivial process by automating the generation of thread synchronization code.

Also there are parallel fors, like so:

    parallel for x = 1 to 5:
        print "x = %d" | x
        parallel for y = 10 to 20:
            print "y = %d" | y
        sleep 0.1

    print "Nested parallel for loop completed."
It is not ready for use at all currently, though will likely see further development until it is.

Compiler implemented in Go, originally with Participle, recursive-descent approach. All examples in the examples directory compile.