Gleam stops compiling to Erlang source, and builds get much faster

Gleam doesn't compile to Erlang source anymore

Gleam stops compiling to Erlang source, and builds get much faster

Gleam v1.19.0 rewrites its Erlang code generator to emit Erlang abstract forms instead of Erlang source, skipping the front half of the Erlang compiler. Build times drop sharply, and BEAM crash reports and stacktraces now point to accurate Gleam line numbers. The release also flattens JavaScript pattern matching, optimizes short list literals, and adds TypeScript overloads that preserve type parameters.

We never have to hear someone use the word "transpiler" as a pejorative ever again.
  1. 0x69420

    to those curious, erlang abstract form[1] is the AST representation used by the erlang compiler/etc. per [1], you can see that it's canonically made of erlang terms, and you have easy access to routines for manipulating this representation from the standard library; it's really comfy when you need it! it's also the target elixir compiles down to, and the representation manipulated by parse transforms, which in base erlang are the way syntactic sugar (notably qlc[2] and some of the more cutesy pattern matches in merl[3] (which, in turn, manipulates the very same representation to do its job. very meta!)) is done.

    most BEAM languages actually settle on erlang abstract format. you'd think core erlang would be more common since it feels more like a traditional functional IR, but basically only LFE does this, because it's a moving target without any particular stability guarantees from release to release.

    1: https://www.erlang.org/doc/apps/stdlib/erl_parse.html#t:abst...

    2: https://www.erlang.org/doc/apps/stdlib/qlc.html#q/2

    3: https://www.erlang.org/doc/apps/syntax_tools/merl.html

  2. giancarlostoro

    Erlang is one of those runtimes I've loved since learning about it all the way back in 2008, but I never took time to learn the syntax, but Elixir and Gleam have had me fiddling with the Erlang VM over the years. Happy to see Gleam growing into maturity.

  3. MichaelNolan

    Gleam is such a beautiful language. I wish I had the opportunity to use it more. If it could compile (transpile) to a native target like rust or go, it would be truly perfect.

  4. zachrip

    Shout out to Giacomo's twitch streams. He has taught me about some features of Gleam, Rust, and on top of that he's just a very chill person. He takes time away from his focus to answer questions politely and without judgement. There are dozens of programming streams where the streamer forgets to leave their ego at the door and he is not one of them. I highly recommend following it.

  5. tiffanyh

    The title is a bit misleading because one might imply that Gleam no longer compiles to something Erlang can use (not true).

    From the article:

    > Over the last few months Giacomo Cavalieri has entirely rewritten Gleam's Erlang code generator that has an entirely different design, and most notably, outputs a different format. Previously Gleam generated Erlang source code, now it generates Erlang abstract forms.

  6. olexsmir

    I love seeing how gleam gets better and better with every release, sadly I dont have any projects where I could use gleam :(

  7. __jonas

    Pretty exciting change that I didn’t see coming —- I wonder if someone will end up implementing an integration with the Whatsapp Erlang debugger

  8. impoppy

    This raises an obvious question. Why Gleam team weren't doing that in the first place? Obviously they didn't have direct Gleam AST -> Erlang source pipeline, they must have had to build some their own custom Erlang AST representation that they then translated into the source code.

More from this day

2026-10-06