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

Grammar railroad diagram #1

Open
mingodad opened this issue Jan 20, 2023 · 0 comments
Open

Grammar railroad diagram #1

mingodad opened this issue Jan 20, 2023 · 0 comments

Comments

@mingodad
Copy link

Using some online tools like https://www.bottlecaps.de/rr/ui and https://www.bottlecaps.de/convert/ and joining all grammars and manually adding the tokens from the lexers we can have a nice navigable railroad diagram.

Copy and paste the EBNF shown bellow on https://www.bottlecaps.de/rr/ui on the tab Edit Grammar the click on the tab View Diagram to see/download a navigable railroad diagram.

/* converted on Fri Jan 20, 2023, 12:07 (UTC+01) by bison-to-w3c v0.62 which is Copyright (c) 2011-2022 by Gunther Rademacher <[email protected]> */

slist    ::= sterm+
sterm    ::= mathExpr ( ASOP? NOUNSTR )? ( ',' | END )
mathExpr ::= ( mathExpr ( ADDOP | MINUSOP | MULTOP | DIVOP | REMOP | EXPOP | BITANDOP | BITOROP ) | MINUSOP | ADDOP ) mathExpr
           | NOUNSTR ( '(' ( MULTOP | mathExpr ( ',' mathExpr )? ) ')' )?
           | ( ( FORMAT_UNIXTIME_GMT | FORMAT_UNIXTIME_LOCAL ) '(' mathExpr ',' ( NOUNSTR | STRLIT ) | '(' mathExpr ) ')'
           | STRLIT
           | NUMBER

/* converted on Fri Jan 20, 2023, 12:08 (UTC+01) by bison-to-w3c v0.62 which is Copyright (c) 2011-2022 by Gunther Rademacher <[email protected]> */

flist    ::= fterm+
fterm    ::= NOUNSTR ( ',' | ( JOINOP NOUNSTR ( ( ASOP NOUNSTR )? ( ONOP compRange | USINGOP ( NOUNSTR | '(' NOUNSTR ')' ) )? | NOUNSTR ( USINGOP ( NOUNSTR | '(' NOUNSTR ')' ) | ONOP compRange ) ) )? END | NOUNSTR ( ',' | ( JOINOP NOUNSTR NOUNSTR? ( USINGOP ( NOUNSTR | '(' NOUNSTR ')' ) | ONOP compRange ) )? END ) | ASOP NOUNSTR ( ',' | ( JOINOP NOUNSTR ( ASOP NOUNSTR )? ( ONOP compRange | USINGOP ( NOUNSTR | '(' NOUNSTR ')' ) )? )? END ) )
compRange
         ::= compRange2
           | compRange3
compRange2
         ::= mathExpr ( EQOP | NEQOP | LTOP | LEOP | GTOP | GEOP ) mathExpr
compRange3
         ::= mathExpr ( ( LTOP | LEOP ) mathExpr ( LTOP | LEOP ) | ( GTOP | GEOP ) mathExpr ( GTOP | GEOP ) | BETWEENOP mathExpr ANDOP ) mathExpr
mathExpr ::= ( mathExpr ( ADDOP | MINUSOP | MULTOP | DIVOP | REMOP | EXPOP | BITANDOP | BITOROP ) | MINUSOP | ADDOP ) mathExpr
           | NOUNSTR ( '(' mathExpr ( ',' mathExpr )? ')' )?
           | '(' mathExpr ')'
           | NUMBER

/* converted on Fri Jan 20, 2023, 12:09 (UTC+01) by bison-to-w3c v0.62 which is Copyright (c) 2011-2022 by Gunther Rademacher <[email protected]> */

qexpr    ::= ( qexpr ( OROP | XOROP | ANDOP | ANDNOTOP ) | NOTOP ) qexpr
           | '(' qexpr ')'
           | simpleRange
           | compRange2
           | compRange3
simpleRange
         ::= EXISTSOP ( NOUNSTR | STRLIT | '(' ( NOUNSTR | STRLIT ) ')' )
           | NOUNSTR ( INOP ( NUMSEQ | '(' ( NUMBER ( ',' NUMBER )? | ( NOUNSTR | STRLIT ) ( ',' ( NOUNSTR | STRLIT ) )? ) ')' | STRSEQ | INTSEQ | UINTSEQ ) | NOTOP ( NULLOP | INOP ( NUMSEQ | '(' ( NUMBER ( ',' NUMBER )? | ( NOUNSTR | STRLIT ) ( ',' ( NOUNSTR | STRLIT ) )? ) ')' | STRSEQ | INTSEQ | UINTSEQ ) ) | LIKEOP ( NOUNSTR | STRLIT ) | CONTAINSOP ( NOUNSTR | STRLIT | '(' ( NOUNSTR | STRLIT ) ( ',' ( STRLIT | NOUNSTR ) )? ')' | STRSEQ ) | ( EQOP | NEQOP ) ( INT64 | UINT64 | STRLIT | mathExpr ) )
           | ANYOP '(' NOUNSTR ')' ( EQOP NUMBER | INOP NUMSEQ )
           | STRLIT ( EQOP | NEQOP ) NOUNSTR
compRange2
         ::= mathExpr ( EQOP | NEQOP | LTOP | LEOP | GTOP | GEOP ) mathExpr
compRange3
         ::= mathExpr ( ( LTOP | LEOP ) mathExpr ( LTOP | LEOP ) | ( GTOP | GEOP ) mathExpr ( GTOP | GEOP ) | BETWEENOP mathExpr ANDOP ) mathExpr
mathExpr ::= ( mathExpr ( ADDOP | MINUSOP | MULTOP | DIVOP | REMOP | EXPOP | BITANDOP | BITOROP ) | MINUSOP | ADDOP ) mathExpr
           | NOUNSTR ( '(' mathExpr ( ',' mathExpr )? ')' )?
           | ( ( ( FROM_UNIXTIME_LOCAL | FROM_UNIXTIME_GMT ) '(' mathExpr | ( TO_UNIXTIME_LOCAL | TO_UNIXTIME_GMT ) '(' STRLIT ) ',' STRLIT | ( ISO_TO_UNIXTIME_LOCAL | ISO_TO_UNIXTIME_GMT )? '(' mathExpr ) ')'
           | NUMBER
START    ::= qexpr ( END | ';' )

// Tokens

BITOROP ::= "|"
BITANDOP ::= "&"
MINUSOP ::= "-"
EXPOP ::= "^"
ADDOP ::= "+"
MULTOP ::= "*"
DIVOP ::= "/"
REMOP ::= "%"
EXPOP ::= "**"
ASOP ::= [aA][sS]
ONOP ::= [oO][nN]
JOINOP::= [jJ][oO][iI][nN]
USINGOP ::= [uU][sS][iI][nN][gG]
BETWEENOP ::= [bB][eE][tT][wW][eE][eE][nN]
ANDOP ::= [aA][nN][dD]

FORMAT_UNIXTIME_GMT ::= [fF][oO][rR][mM][aA][tT]_[uU][nN][iI][xX][tT][iI][mM][eE]_[gG][mM][tT]
FORMAT_UNIXTIME_LOCAL ::= [fF][oO][rR][mM][aA][tT]_[uU][nN][iI][xX][tT][iI][mM][eE]_[lL][oO][cC][aA][lL]
FORMAT_UNIXTIME_LOCAL ::= [fF][oO][rR][mM][aA][tT]_[uU][nN][iI][xX][tT][iI][mM][eE]

NOTOP ::= "!"
NOTOP ::= "~"
LEOP ::= "<="
NEQOP ::= "!="
NEQOP ::= "<>"
LTOP ::= "<"
GEOP ::= ">="
GTOP ::= ">"
EQOP ::= "="
EQOP ::= "=="
OROP ::= "||"
ANDOP ::= "&&"
ANDNOTOP ::= "&!"
ANDNOTOP ::= "&~"
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

No branches or pull requests

1 participant