We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
With something like this mingodad@d8e43ed and using https://www.bottlecaps.de/convert/ to convert the naked output to be used here https://www.bottlecaps.de/rr/ui to get a railroad diagram for the grammars written to PeppaPEG.
naked
Example:
../cli parse -n -G peppa.peg -e grammar peppa.peg grammar = ( start_of_input rule+ end_of_input ) ; start_of_input = &. ; end_of_input = !. ; rule = ( decorators name /*~*/ "=" expression ";" ) ; decorators = decorator* ; decorator = ( "@" /*~*/ ( "squashed" / "scoped" / "spaced" / "lifted" / "tight" / "nonterminal" ) ) ; /*@squashed*/ name = reference ; /*@lifted*/ expression = left_recursion ; /*@nonterminal*/ left_recursion = ( choice ( "|" /*~*/ reference choice )? ) ; /*@nonterminal*/ choice = ( sequence ( ! ( "//" / "/*" ) "/" sequence )* ) ; /*@nonterminal*/ sequence = repeat+ ; /*@nonterminal*/ repeat = ( primary ( onceormore / zeroormore / zerooronce / repeatexact / repeatminmax / repeatmin / repeatmax )? ) ; onceormore = "+" ; zeroormore = "*" ; zerooronce = "?" ; repeatexact = ( "{" number "}" ) ; repeatminmax = ( "{" number "," number "}" ) ; repeatmin = ( "{" number "," "}" ) ; repeatmax = ( "{" "," number "}" ) ; /*@lifted*/ primary = ( literal / insensitive / range / ( reference !"=" ) / back_reference / positive / negative / ( "(" choice ")" ) / dot / cut ) ; /*@squashed*/ /*@tight*/ literal = ( "\"" /*~*/ chars "\"" ) ; chars = char* ; /*@squashed*/ /*@tight*/ char = ( [\x20-\x21] / [\x23-\x5b] / [\x5d-\U0010ffff] / ( "\\" ( "\"" / "/" / "\\" / "b" / "f" / "n" / "r" / "t" / "v" / ( "x" /*~*/ two_hexdigits ) / ( "u" /*~*/ four_hexdigits ) / ( "U" /*~*/ eight_hexdigits ) ) ) ) ; /*@squashed*/ /*@tight*/ range_category = ( [a-z] / [A-Z] / [0-9] / "_" / " " )+ ; range = ( "[" ( ( char "-" char ( ".." number )? ) / ( "\\p{" range_category "}" ) ) "]" ) ; /*@tight*/ insensitive = ( "i" ( literal / back_reference ) ) ; /*@squashed*/ /*@tight*/ reference = ( ( [a-z] / [A-Z] / "_" ) ( [a-z] / [A-Z] / [0-9] / "_" )* ) ; /*@tight*/ back_reference = ( "\\" /*~*/ number ) ; positive = ( "&" /*~*/ primary ) ; negative = ( "!" /*~*/ primary ) ; dot = "." ; cut = "~" ; hexdigit = ( [0-9] / [a-f] / [A-F] ) ; two_hexdigits = hexdigit{2} ; four_hexdigits = hexdigit{4} ; eight_hexdigits = hexdigit{8} ; /*@squashed*/ /*@tight*/ number = ( "0" / ( [1-9] [0-9]* ) ) ; /*@lifted*/ /*@spaced*/ comment = ( ( ( "#" / "//" ) ( !"\n". )* "\n"? ) / ( "/*" ( !"*/". )* "*/" ) ) ; /*@lifted*/ /*@spaced*/ whitespace = ( " " / "\t" / "\r" / "\n" ) ;
Then coping and pasting the output shown above on https://www.bottlecaps.de/convert/ on the Input grammar: textarea and then clicking the button Convert then the button View Diagram we get a nice railroad diagram (https://en.wikipedia.org/wiki/Syntax_diagram) for the grammar.
Input grammar:
Convert
View Diagram
The text was updated successfully, but these errors were encountered:
No branches or pull requests
With something like this mingodad@d8e43ed and using https://www.bottlecaps.de/convert/ to convert the
naked
output to be used here https://www.bottlecaps.de/rr/ui to get a railroad diagram for the grammars written to PeppaPEG.Example:
Then coping and pasting the output shown above on https://www.bottlecaps.de/convert/ on the
Input grammar:
textarea and then clicking the buttonConvert
then the buttonView Diagram
we get a nice railroad diagram (https://en.wikipedia.org/wiki/Syntax_diagram) for the grammar.The text was updated successfully, but these errors were encountered: