Open mingodad opened 1 year ago
Thanks for the suggestion! These will look nice in our documentation. Keeping this issue open as as a reminder.
I do think some parts of the grammar may still change on our way to 1.0 release, but others should be stable.
@mingodad @burakemir, there are railroad generation tools for ANTLR. If you can let me know which directory you want them in, I can add a script for generating them / Just insert the railroad diagrams.
Let's maybe start with an svg for plain Datalog atoms / facts first, with recursion and negation? However the mangle syntax evolves (the syntax in first post is already outdated, since map and struct constants were added), one needs to understand this core first. (edit: formatting)
clause ::= atom (':-' clauseBody)? '.'
clauseBody ::= literal (',' literal)*
literal ::= atom | '!' atom
atom ::= predicateName '(' varOrConstant (',' varOrConstant)* ')'
varOrConstant ::= variable | constant
It's on a matter to pass https://raw.githubusercontent.com/google/mangle/main/parse/gen/Mangle.g4 through https://www.bottlecaps.de/convert/ and then click View Diagram
as I just did and updated the EBNF from the first post https://github.com/google/mangle/issues/3#issue-1465384133
Using some online tools like https://www.bottlecaps.de/rr/ui and https://www.bottlecaps.de/convert/ we can have a nice navigable railroad diagram.
Copy and paste the
EBNF
shown bellow on https://www.bottlecaps.de/rr/ui on the tabEdit Grammar
the click on the tabView Diagram
to see/download a navigable railroad diagram.