8000 Feature request: add language from the "Railroad-diagram Generator" · Issue #48 · katef/kgt · GitHub
[go: up one dir, main page]

Skip to content

Feature request: add language from the "Railroad-diagram Generator" #48

Open

Description

@dolmen

Add support for the language from the Railroad-diagram Generator as input.

Example:

Diagram(
  Optional('+', 'skip'),
  Choice(0,
    NonTerminal('name-start char'),
    NonTerminal('escape')),
  ZeroOrMore(
    Choice(0,
      NonTerminal('name char'),
      NonTerminal('escape'))))

Online:
https://tabatkins.github.io/railroad-diagrams/generator.html

Format documentation:
https://github.com/tabatkins/railroad-diagrams#components

Activity

  1. katef commented on Apr 7, 2021

    @katef
    Owner

    Hi! Thanks! This is interesting. kgt's input is usually BNF, which is supposed to be a semantic representation of a grammar. Tab's structure here is for presentational information. For example, it offers Stack() for vertically placed alts.

    kgt has several stages internally. Relevant here are the AST for BNF, and then the RRD tree (which is presentational, although still abstracted from layout coordinates).

    So we'd have two options for parsing this;

    • to disregard the presentational parts, and construct the BNF AST as if it were any other BNF input.
    • to construct the RRD node tree directly. although it doesn't currently offer a Stack() construct, so we'd still skip that.

    Both could make sense.

    https://github.com/katef/kgt/blob/main/src/ast.h
    https://github.com/katef/kgt/blob/main/src/rrd/node.h

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

      0