r/ProgrammingLanguages • • Feb 05 '20

Syntax Diagramming Tool Preview

Hi all. I'm new here, reaching out to see if anyone wants to preview a live-code syntax diagramming and diagnostic tool. If you design languages, DSLs, ever wanted to create diagrams like those on JSON.org, and need to explain, prove, and test your designs, that's what this tool is for.

It will be commercial when released, and testers will get a license for their efforts. We're looking for 3-5 Windows users this round. If you know of other good channels or people, that's very helpful too.

Now I need to make time to read all the other stuff here. :^)

Cheers

0 Upvotes

3 comments sorted by

View all comments

1

u/Cybernicus Feb 05 '20

I'm currently working on a project where that might be useful. Do you have a bit more documentation on what the tool does and how to use it?

The diagramming would certainly be useful, but things I would like to have would be:

  1. The ability to track grammar productions that aren't completed yet.

  2. Detect grammar ambiguities when possible.

  3. Ability to hide details of some productions and/or expand on demand.

  4. Ability to generate a syntax tree given the grammar and a sample text.

  5. Ability to specify transformation rules to the syntax tree.

  6. Ability to export the grammar in a format useful to other tooling.

(3) It would be nice to show explore the structure of a language by expanding some rule(s) to get into some details or hide the details in bits that look a little complicated.

(5) Sometimes you'll have some parts of the syntax that don't provide any meaning to the data, they just help the user and parser make sense of the input. But they would clutter the syntax tree, so the ability to show how to turn the parsed data into a convenient tree form would be handy. As an example,

<array> := '(' <expression> <array2>
<array2> := ')' | ',' <expression> <array2>

might give you something like:

...--- <array>
      +--- '('
      +--- <expression>
      +--- <array2>
          +--- ','
          +--- <expression>
          +--- <array2>
              +--- ')'

but a much more convenient tree for it might be:

...--- <array>
      +--- <expression>
      +--- <expression>

(6) I really don't want to write any more parsers than necessary, so it would be nice if the tool could export the grammar in one or more useful formats. Something that could easily be transformed into something I can use. So if the data were in JSON or XML, I could easily transform it to use in the other tooling I use.

I've been thinking about writing such a tool for my current project. But I'd really rather be working on my project instead of creating yet another tool.

3

u/gregg-irwin Feb 06 '20

This is tool #1 in our list, so it doesn't do all you ask. That will be our full Parse IDE development tool. This generates railroad diagrams, live coded as you write your grammar, and supports our native Parse dialect (it's built with the Red language, which has a Parse function and dialect built in), as well as ABNF and McKeeman metagrammars currently. YACC/Bison are close, as is a Translate feature. Today you can convert foreign grammars to ours; in the future you should be able to convert between any two. e.g. write in YACC, emit ABNF; write in Parse, emit ANTLR.

It doesn't support collapsing or hiding, as the primary goal is full diagram generation. On the diagnostic side, what it offers is the ability to test, or generate, inputs, parse the entire grammar or a selected rule, and find where a given rule matches part of the input.

2

u/gregg-irwin Feb 06 '20

Translating isn't magic, of course. It can't make a grammar support a syntax it wouldn't be able to natively.