Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation generator for LALRPOP ( markdown, railroad diagram svg, ebnf ) #658

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

darach
Copy link

@darach darach commented Mar 20, 2022

We use LALRPOP on the tremor project for
defining the grammar of our embedded DSLs. Up until the current release, we have been maintaining
a proximate EBNF file and using online railroad diagram generators to assist with our language reference.

This has proven cumbersome, error prone and high maintenance!

This PR is a work in progress extension to LALRPOP that derives EBNF from the LALRPOP grammar, generates
railroad diagrams with support for LALRPOP macro rules visually, and generates markdown for the grammar
that is compatible with github markdown, pandoc, docusaurus.

The markdown can be annotated with human-maintained markdown files.

A few small changes to the core lalrpop package is needed to expose the parse tree such that
the grammar can be visited. If changes come to mind to align it better with the other LALRPOP crates
happy to make any such changes.

The same pic-args, session, config and api pattern was used with the lalrpop-docgen tool but this
tool hasn't yet been tested with or integrated with build.rs style usage.

Signed-off-by: Darach Ennis darach@gmail.com

Signed-off-by: Darach Ennis <darach@gmail.com>
@darach
Copy link
Author

darach commented Mar 20, 2022

Here's a repo with the example calculator.lalrpop output rendered on github:

https://github.com/darach/lalrpop-docgen-calculator

@darach
Copy link
Author

darach commented Mar 23, 2022

Nods to @brendanzab - liking fathom 👀 👍

Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
@brendanzab
Copy link
Contributor

Nods to @brendanzab - liking fathom 👀 👍

Heh, glad you are enjoying it! Just a heads up that the active repo is at yeslogic/fathom 😊

Signed-off-by: Darach Ennis <darach@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
@darach
Copy link
Author

darach commented May 3, 2022

This has worked well for documentation on the current release of tremor. The full generated docset for the tremor lalrpop grammar is now live here deployed with docusaurus v2 beta.

@darach darach changed the title Draft: Documentation generator for LALRPOP ( markdown, railroad diagram svg, ebnf ) Documentation generator for LALRPOP ( markdown, railroad diagram svg, ebnf ) May 3, 2022
@darach darach marked this pull request as ready for review May 3, 2022 10:45
Licenser and others added 6 commits May 5, 2022 12:32
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
Signed-off-by: Darach Ennis <darach@gmail.com>
Make image markup in generated markup support a switchable style
Use markdown images by default with switchable alternative back to html `img` tags
@darach
Copy link
Author

darach commented Jul 14, 2022

👋 Wondering if this branch is ok to merge or if there are related docs changes desireable for completeness. We've had no issues in our CI/CD system with this to date. Please let us know if there's anything we can/should clean up!

@nikomatsakis nikomatsakis added this to the 1.0 milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants