Explicit loop kill-points
Loreal introduces a dedicated loop construct where `next` becomes a structural boundary for liveness and reuse analysis.
Loreal is a programming language project by Pasindu Pramodya, a system engineer focused on deterministic memory management,
compile-time reference counting, and a dedicated loop
construct that exposes reuse opportunities instead of hiding them inside
recursion.
Read the research paper
The paper argues that a dedicated loop construct gives
the compiler stronger lifetime information than general recursion,
enabling compile-time reference counting, deterministic drops, and
Functional But In-Place mutation when uniqueness is preserved.
Explain the language
Loreal is a functional language design that tries to bridge semantic clarity and hardware efficiency without using tracing GC or pushing ownership annotations onto the programmer. The compiler pipeline is designed around exact last-use analysis, explicit drops, and reuse opportunities that emerge from loop boundaries.
Why this functional language matters
next acts as a hard kill-point, making current-iteration
bindings dead before the back edge.
Interactive playground
The playground section shows the syntax direction and loop-oriented model. The run path is intentionally disabled until the compiler and browser integration exist.
Loop-specialized filter
def filter_loop(list, p) do
loop (list, []) (curr, acc) ->
match curr do
Nil -> break(reverse(acc))
Cons(x, xs) ->
if p(x) do
next(xs, Cons(x, acc))
else
next(xs, acc)
end
end
end
end
Minimal loop shape
loop (init_val) (var) -> {
if (condition) {
next(updated_val)
} else {
break(result)
}
}
Key features
Loreal introduces a dedicated loop construct where `next` becomes a structural boundary for liveness and reuse analysis.
The design follows compile-time reference counting with precise drop insertion instead of runtime tracing GC pauses.
Pure-looking transformations can reuse memory in place when uniqueness holds, targeting O(1) overhead per iteration.
ANF, MIR CFG construction, liveness passes, and LLVM lowering are central to the language design from the start.
Development roadmap
Stabilize parser, AST, and core syntax for the `loop` construct.
Finish MIR CFG generation and liveness analysis around `next` boundaries.
Implement RC insertion and greedy reuse detection for drop-to-alloc patterns.
Lower reuse tokens into LLVM conditional reuse blocks.
Ship the first public docs and a runnable browser playground.