CodeWitchBella
← Back to blog index

Lezer playground

Published: 2023-10-19

Today I found Lezer, thought it was cool and used it for a project. As such, I started writing a blog post that was explaining how it works before knowledge of it exits my brain. Well, that did not go as planned. Instead I created a playground which allows you to edit Lezer grammar and see how it applies to a given snippet of code. Maybe some day I'll finish the original blog post. In the mean time, enjoy the playground 😉

If you found it useful, feel free to ping me on mastodon.

Grammar

Example code

Highlighting:
FileLineSectionStartChordChordContentEOF

Parsed tree

File(
  Line(
    SectionStart,
    Chord(
      ChordContent
    ),
    Chord(
      ChordContent
    )
  ),
  Line(
    Chord(
      ChordContent
    ),
    Chord(
      ChordContent
    )
  ),
  Line(
    Chord(
      ChordContent
    ),
    Chord(
      ChordContent
    )
  ),
  Line(
    Chord(
      ChordContent
    ),
    Chord(
      ChordContent
    ),
    EOF
  )
)

Colors in example higlighting are borrowed from sashamaps.net.