Skip to content

Cannot generate railroad diagrams for ABNF files from the examples #68

Open

Description

@ashwin

I tried to generate railroad diagram for the TOML file format's ABNF grammar and it failed silently:

$ kgt -l abnf -e rrtext < toml.abnf

There are 5 ABNF example files that ship with kgt:

$ ls -1 examples/*.abnf
examples/abnf.abnf
examples/datetime.abnf
examples/irc.abnf
examples/postal.abnf
examples/utf8.abnf

kgt is able to generate railroad diagrams only for 2 of them. The following 3 ABNF files do not product any output:

$ kgt -l abnf -e rrtext < examples/abnf.abnf
$ kgt -l abnf -e rrtext < examples/irc.abnf
$ kgt -l abnf -e rrtext < examples/postal.abnf

What am I doing wrong? 🤔

Activity

  1. katef commented on Apr 8, 2025

    @katef
    Owner

    Hello! You aren't doing anything wrong. Some of these contain comments that kgt currently mishandles; I've kept them verbatim because they're correct ABNF syntax.

    Some are missing newlines that are technically required - I've also kept these because they are common, and I think kgt should handle them.

    I consider these both bugs in kgt's lexing, but haven't gotten to fixing them yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions