# Gleam doesn't compile to Erlang source anymore

DevFeed: [Gleam doesn't compile to Erlang source anymore](<https://devfeed.tech/articles/gleam-doesn-t-compile-to-erlang-source-anymore-64919.md>)

Original publisher: [Read original article](<https://gleam.run/news/gleam-doesnt-compile-to-erlang-source-anymore>)

Author: Louis Pilfold

Published: 2026-10-05T00:00:00Z

Content type: release

Language: en

Sources: [Gleam](<https://devfeed.tech/sources/gleam.md>)

Topics: [Compiler](<https://devfeed.tech/topics/compiler.md>), [Erlang](<https://devfeed.tech/topics/erlang.md>), [Code generation](<https://devfeed.tech/topics/code-generation.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>)

Tags: [beam](<https://devfeed.tech/tags/beam.md>), [build-times](<https://devfeed.tech/tags/build-times.md>), [code-generator](<https://devfeed.tech/tags/code-generator.md>), [code-quality](<https://devfeed.tech/tags/code-quality.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [debuggers](<https://devfeed.tech/tags/debuggers.md>), [encoding](<https://devfeed.tech/tags/encoding.md>), [erlang](<https://devfeed.tech/tags/erlang.md>), [gleam](<https://devfeed.tech/tags/gleam.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [metadata](<https://devfeed.tech/tags/metadata.md>), [performance](<https://devfeed.tech/tags/performance.md>), [runtime](<https://devfeed.tech/tags/runtime.md>), [source-code](<https://devfeed.tech/tags/source-code.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [type-safe](<https://devfeed.tech/tags/type-safe.md>), [virtual-machine](<https://devfeed.tech/tags/virtual-machine.md>)

## AI overview

Gleam v1.19.0 rewrites its Erlang code generator to emit Erlang abstract forms, which the Erlang compiler can load directly, skipping its tokenizer and parser. The article reports faster Erlang builds and runtime location metadata that points accurately to Gleam source, improving crash reports and stack traces; debugger support such as edb is described as a possibility, not completed work. It favors abstract forms over direct BEAM bytecode because bytecode changes across VM releases, and reproducing Erlang compiler optimizations would take substantial ongoing effort. The release also flattens generated JavaScript for pattern matches, improves short-list construction while retaining array conversion for longer lists, preserves TypeScript generic types through overloads, adds build-tool support including generated `.app` files and a `--no-dev` flag, and adds language-server label operations, browser formatting capability, and more targeted errors. Its compilation benchmark compares a small synthetic workload and is explicitly limited; it cannot establish performance across real projects.

## Source excerpt

Gleam is a type-safe and scalable language for the Erlang virtual machine and JavaScript runtimes. Today Gleam v1.19.0 has been published, so let's go over what's new. A new compilation target 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. "Erlang abstract forms" is an intermediate representation used by the Erlang compiler. It is a metadata-annotated tree that represents Erlang syntax, and it is normally produced by running Erlang's tokeniser and parser. It has a binary encoding using Erlang's external term format, and with this binary format we can load our generated code directly, skipping the front-half of the Erlang compiler. This new Erlang code generator brings several benefits: The performance of the compiler has been improved, significantly reducing the build times for Gleam projects running on Erlang. The location metadata available to the runtime is now accurate to original Gleam source code, rather than to the Erlang source code the compiler would generate. This means, for example, the line numbers in BEAM crash reports and stacktraces are perfectly accurate, while previously they could be inaccurate, only pointing to the nearest function. This metadata could also enable full support for Gleam in debuggers such as edb, though we have not done any work on this ourselves. The code-quality of the Gleam compiler has been improved. The Erlang code generator was one of the oldest and most stable parts of the Gleam codebase, so while it wasn't causing us any problems it wasn't conforming to the standards and conventions we have today. This new replacement is excellent, and arguably raising the bar for the compiler as whole. We never have to hear someone use the word "transpiler" as a pejorative ever again.1 Ok, so how fast is it? I'm going to s