myna-parser icon indicating copy to clipboard operation
myna-parser copied to clipboard

Create railroad diagrams

Open cdiggins opened this issue 7 years ago • 4 comments

https://github.com/dundalek/GrammKit

cdiggins avatar May 22 '17 13:05 cdiggins

Any thoughts on how to achieve this? Would you go through an intermediate definition?

Hypercubed avatar Feb 20 '18 07:02 Hypercubed

@Hypercubed , sorry I missed your comment. I can generate both AST Schemas and PEG geometry definitions from a Heron grammar. An example output is here https://github.com/cdiggins/heron-language/blob/master/spec.md generated by the tool: https://github.com/cdiggins/heron-language/blob/master/tools/gen-spec.js

cdiggins avatar Feb 27 '18 23:02 cdiggins

So I think that grammKit, just needs something like the PEG grammar definitions but cleaned up a bit.

cdiggins avatar Feb 27 '18 23:02 cdiggins

If I understand correctly the outputs in the heron-language repo are PEG format, while GrammKit takes PEGjs, Ohm, or EBNF. Unless you know a decent way to convert Myna grammar (or PEG) to PEGjs it might be better to process the rules directly into the intermediate format GrammKit uses (basically the output of PEGjs#parse).

This is my attempt so far: https://github.com/Hypercubed/f-flat_node/blob/master/bin/gen-spec.js#L22

It works, but not great... I'm still not sure the correct "translations" of some rules.

Hypercubed avatar Mar 04 '18 02:03 Hypercubed