r/ProgrammingLanguages

Does implementing GC makes languages slow?

Month ago, I created a team of 5 and started working on "Bery - The compiled programming language". By the end of June we have quite good working compiler (it's not complete yet). In Bery we have decided to add the automatic Garbage Collector so we choose the "Mark and Sweep" method for it in the Bery Runtime Environment (BRE).

Now as we are heading forward with adding OOP and Exception Handling, I notice some delays in the compilation of program.

So we are now at this point of discussion - should we remove it from compiler or let it be there.
I will looking forward for help regarding this. and btw these are some constraints we set -

unsigned int BERY_GC_ALLOC_THRESHHOLD = 1000;
size_t BERY_GC_HEAP_SIZE_THRESHHOLD = 4 * 1024 * 1024;
github.com
u/goat-luffy — 1 day ago
▲ 29 r/ProgrammingLanguages+1 crossposts

Probabilistic Programming Language Interpreter

Hi everyone!

I've been developing with Kotlin for many years, mostly building Android apps as a freelancer. Alongside that, I'm studying Computer Science, and I'm particularly interested in programming language theory.

One of the things I enjoy most about Kotlin is how naturally it supports multiple programming paradigms. I usually write Kotlin in a functional style, like an object-oriented version of Haskell.

I recently built an interpreter for a higher-order probabilistic programming language entirely in Kotlin.

The project is based on this book "An Introduction to Probabilistic Programming" and implements the Lisp-like language described there: https://arxiv.org/abs/1809.10756

I think one of the most interesting aspects of these language/s is the idea of checkpoints (sample and observe), which act as execution breakpoints that inference algorithms can intercept and control.

That mechanism is really the heart of the interpreter, and it's quite easy to handle in Kotlin.

I thought some people here might find this project interesting. It's a nice jump off the Android zone of this language.

Repository: https://github.com/LeoBrasileo/HOPPL-Interpreter

u/LeoBrasileo — 1 day ago

How to create a compiler?

Pretty sure you may have heard this question previously on this sub, however, I would urge you to read my complete question before brushing it off.

I want to create a simple compiler and by "simple compiler" I mean a single-pass compiler. I know about https://craftinginterpreters.com/ which is a wonderful resource. But I would like to start by creating something much smaller and simpler, and only then would I like to move on to something more complex like what Robert Nystrom created on his website.

Are there any similar resource that would teach me about single-pass compilers along with showing me how to create one? Any help in the right direction would be highly appreciated.

reddit.com
u/UnemployedTechie2021 — 2 days ago
▲ 85 r/ProgrammingLanguages+3 crossposts

How does Elixir 1.20's type system actually differ from what TypeScript or Dialyzer do - and does the distinction matter in practice?

New BEAM There, Done That with Annette Bieniusa (RPTU, Germany) and Guillaume Duboc (Dashbit, PhD from IRIF Paris) on the theoretical and practical story behind what's shipping in Elixir 1.20.

The episode covers the set-theoretic foundation, the gradual design, and the long history of failed attempts at typing Erlang since 1995. But the thing that stuck with me most was the framing of what the type system is and isn't trying to do:

The BEAM ran telecoms for 25 years without static types, with seconds of downtime per year. Supervision trees and let it crash handle an entirely different class of failures from what a type checker catches. The argument for types here isn't that the runtime is broken - it's that type errors are a separate cost (restarts, latency, overprovisioning) that supervision handles but doesn't eliminate. Even catching 5% of those at compile time instead has measurable infrastructure impact.

What got me thinking: the episode raises the false confidence risk - developers seeing types and writing fewer supervision trees, less defensive code, no recovery strategy. Has anyone here actually observed this shift in teams adopting typed languages? And do you think the BEAM community is more or less susceptible to it than others, given how explicitly OTP teaches you to expect failure?

https://youtu.be/X_CPDt3PeDE?si=yJTRAwlAaf7h2rlZ

u/rtrusca — 3 days ago

Community projects?

I've had a hard time telling just from casual browsing of the sub, what languages here are considered community projects, if any. Looking for places open to contribution.

Replaced original text to both get to the point, and avoid disparaging peoples personal projects, that's not my intention.

reddit.com
u/SergeAzel — 3 days ago
▲ 10 r/ProgrammingLanguages+1 crossposts

UNIT: Compiler backend library using stack-based IR

Hi everyone,

For the past few weeks, I've been working on a project that I think is pretty cool, and I wanted to share it with you guys. I call it "UNIT" ("Unified Native Instruction Translator"). Essentially, it's a combination of the instruction sets used in interpreted stack machines with actual machine code.

I wrote it in C, but I have bindings for C++ and Python, since C is pretty verbose. Here's an example in both of those:

unit::Context ctx;
unit::Procedure proc(ctx, "add");

proc.load_argument(0);
proc.load_argument(1);
proc.add();
proc.return_value();

proc.optimize();
auto compiled = proc.compile(unit::Platform::host());
auto add = compiled.jit<int64_t(*)(int64_t, int64_t)>();

printf("%ld\n", add(3, 4)); // 7
import unit

proc = unit.Procedure("add")

proc.load_argument(0)
proc.load_argument(1)
proc.add()
proc.return_value()

proc.optimize()
compiled = proc.compile()
add = compiled.jit()

print(add(3, 4))  # 7

So far, I've implemented a number of examples using my compiler. My personal favorite is the interpreted language with a JIT, which works fairly well and is just about 1k lines of Python.

I got the idea for this after working on Python's bytecode compiler (which emits instructions for Python's stack-based interpreter loop). I had also been experimenting with LLVM for a separate hobby project, and the difference between the two development experiences was huge. I wanted to combine the DX of stack machines with the ability to actually generate real machine code.

This is still early in development and not production-ready, as it only supports x86-64 on ELF right now with only some primitive optimizations, but I'd appreciate feedback on the API design, the IR, or anything else about the project. If you spot bugs, please feel free to let me know!

GitHub: https://github.com/ZeroIntensity/unit

reddit.com
u/ZeroIntensity — 3 days ago
▲ 25 r/ProgrammingLanguages+4 crossposts

A Multi-Dimensional, Per-Pass Empirical Study of the LLVM Optimization Pipeline

Hi Folks!

I simply want to share this empirical study on the LLVM -O3 pipeline on the PolyBench suite.
I don't want to bore you with too many details that are already in the paper.
Any feedback is welcome :D

Blog post: https://federicobruzzone.github.io/posts/a-multi-dimensional-per-pass-empirical-study-of-the-llvm-optimization-pipeline.html
arXiv: https://arxiv.org/pdf/2606.31238

reddit.com
u/FedericoBruzzone — 4 days ago
▲ 14 r/ProgrammingLanguages+2 crossposts

Writing a compiler book

So, I decided to write a book on compiler theory! It is past midnight where I live so only 1 chapter is done. I have came here looking for some things that could be improved on it. The link is attached.

docs.google.com
u/StrikingClub3866 — 5 days ago

July 2026 monthly "What are you working on?" thread

How much progress have you made since last time? What new ideas have you stumbled upon, what old ideas have you abandoned? What new projects have you started? What are you working on?

Once again, feel free to share anything you've been working on, old or new, simple or complex, tiny or huge, whether you want to share and discuss it, or simply brag about it - or just about anything you feel like sharing!

The monthly thread is the place for you to engage /r/ProgrammingLanguages on things that you might not have wanted to put up a post for - progress, ideas, maybe even a slick new chair you built in your garage. Share your projects and thoughts on other redditors' ideas, and most importantly, have a great and productive month!

reddit.com
u/AutoModerator — 5 days ago

Is grammar a crude form of a... type system?!

This has been on my mind for some time now, so I'm asking to clear up my confusion. I'm interested how people who are knowledgeable reason about these kinds of things.

In C, you can't pass types to functions, for example. This is rejected: f(1, 2, int). It's interesting how it's rejected: due to how the grammar is defined, the parser can outright reject it if it's encountered.

However, you could reject such a construct in another way. You could relax the grammar rules, and change the type system "a bit" so that types are also values. Then, you could define very strict rules about how types and operations between them interact/behave and arrive at the same semantics. After parsing, the type-checker would then not accept the same exact construct. Atleast, that's what I think, I haven't actually tried any of this in practice.

Also, inside the compiler, we model the syntax using types. And so, if grammar rules change significantly, those types must too!

Small note: C isn't the greatest example, because its grammar isn't entirely context-free, but I don't think this matters much for the example.

Cheers!

reddit.com
u/8d8n4mbo28026ulk — 6 days ago
▲ 15 r/ProgrammingLanguages+1 crossposts

Aether: high performance with elegant semantics

We've been building a language called Aether. It compiles straight to C, so it runs at native speed with no GC and nothing sitting underneath at runtime. The part I care about is that it doesn't feel like writing C: you get pattern matching, optionals, a real actor model for concurrency, and you can build your own DSLs right in the language without macros.

The whole point has been keeping the semantics clean without paying for it in speed. I'd love your honest take. Please don't hesitate to ask me anything.

Aether: https://github.com/aether-lang-org/aether
Org: https://github.com/aether-lang-org (Ecosystem being built)

u/RulerOfDest — 6 days ago