Reach.Frontend.Gleam (Reach v2.6.1)

Copy Markdown View Source

Gleam source frontend — parses .gleam files into Reach IR.

Uses the glance Gleam parser (if available on the code path) for accurate AST with byte-offset spans. Falls back to analyzing the generated Erlang output when glance is not available.

To enable native parsing, build glance and add its ebin to your path:

git clone https://github.com/lpil/glance /tmp/glance
cd /tmp/glance && gleam build --target erlang
# glance beams are in /tmp/glance/build/dev/erlang/*/ebin/

Summary

Functions

build_line_offsets(source)

byte_to_line(offsets, byte_offset)

extensions()

parse_file(gleam_path, opts \\ [])

@spec parse_file(
  Path.t(),
  keyword()
) :: {:ok, [Reach.IR.Node.t()]} | {:error, term()}