Open mingodad opened 1 year ago
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 tab Edit Grammar the click on the tab View Diagram to see/download a navigable railroad diagram.
EBNF
Edit Grammar
View Diagram
/* converted on Wed Feb 8, 2023, 10:21 (UTC+01) by pegjs-to-w3c v0.62 which is Copyright (c) 2011-2022 by Gunther Rademacher <grd@gmx.net> */ SqrlScript ::= "'use migrate';"? SqrlClosedStatement* FinalWhitespace SqrlRepl ::= _? SqrlClosedStatement* ( SqrlStatement | SqrlExpr )? _? ';'? FinalWhitespace SqrlExpr ::= _? Expr _? SqrlClosedStatement ::= _? SqrlStatement _? ';' SqrlStatement ::= AssertStatement | ExecuteStatement | IncludeStatement | LetStatement | RuleStatement | WhenStatement | ListComprehensionExpr | CallStatement IncludeStatement ::= 'INCLUDE' _ ( 'LIBRARY' _ )? String WhereClause? AssertStatement ::= 'ASSERT' _ Expr ExecuteStatement ::= 'EXECUTE' ( _ Number _ 'TIMES' )? SkipWaitClause? DefaultClause ::= _ 'DEFAULT' SwitchClause ::= DefaultClause | WhereClause LetStatement ::= LetKeyword LetDescriptionClause? _ Feature _? ':=' _? Expr SwitchClause? LetKeyword ::= 'DEFAULT' | 'LET' | 'FINAL' LetDescriptionClause ::= _ String RolloutClause ::= _ 'ROLLOUT TO' _ IntLiteral '%' RuleStatement ::= ( 'CREATE' | 'DEFAULT' ) LetDescriptionClause? _ NewRuleClause WhenStatement ::= 'WHEN' _ ( NewRuleClause | RulesExpr ) _ 'THEN' _ WhenStatementList NewRuleClause ::= SyncClause? 'RULE' _ Feature ( _ 'ALIAS' _ Feature )? WhereClause? ReasonClause? RolloutClause? SyncClause ::= ( 'SYNC' | 'ASYNC' ) _ WhenStatementList ::= CallExpr ( _? ',' _? CallExpr )* RulesExpr ::= ( 'RULES' _ )? FeatureExpr ( _? ',' _? FeatureExpr )* CallStatement ::= CallExpr WhereClause? CallExpr ::= CustomCallExpr | SimpleCallExpr CustomCallExpr ::= Func _? '(' CustomCallSource ')' SimpleCallExpr ::= Func _? '(' _? ExprList? _? ')' ExprList ::= Expr ( _? ',' _? Expr )* SubExpr ::= '(' _? Expr _? ')' LazyExpr ::= 'LAZY' _ Expr EagerExpr ::= 'EAGER' _ Expr WhereClause ::= _ 'WHERE' _ Expr ReasonClause ::= _ 'WITH REASON' _ String SkipWaitClause ::= _ ( 'WITHOUT' | 'WITH' ) _ 'WAIT' DataObjectExpr ::= EmptyDataObjectExpr | NonEmptyDataObjectExpr EmptyDataObjectExpr ::= '{' _? '}' NonEmptyDataObjectExpr ::= '{' _? DataObjectPair _? ( ',' _? DataObjectPair _? )* ','? _? '}' DataObjectPair ::= ConstantString _? ':' _? Expr | Feature ListExpr ::= EmptyListExpr | ListComprehensionExpr | NonEmptyListExpr ListComprehensionExpr ::= '[' _? Expr _ 'FOR' _ FeatureExpr _ 'IN' _ Expr WhereClause? _? ']' EmptyListExpr ::= '[' _? ']' NonEmptyListExpr ::= '[' _? Expr _? ( ',' _? Expr _? )* ','? _? ']' Expr ::= BooleanExpr BooleanExpr ::= BinaryBooleanExpr | UnaryBooleanExpr | BooleanTerm BinaryBooleanExpr ::= UnaryBooleanExpr _ ( 'AND' | 'OR' ) _ BooleanExpr UnaryBooleanExpr ::= NotBooleanTerm | BooleanTerm NotBooleanTerm ::= 'NOT' _ UnaryBooleanExpr BooleanTerm ::= BinaryLogicalExpr | IsNullLogicalExpr | LogicalTerm IsNullLogicalExpr ::= LogicalTerm _? ( 'IS NOT' | 'IS' ) _? 'NULL' BinaryLogicalExpr ::= LogicalTerm _? ( '=' | '!=' | '>=' | '<=' | '>' | '<' | 'CONTAINS' | 'IN' ) _? LogicalTerm LogicalTerm ::= BinaryArithmeticExpr | ArithmeticTerm ArithmeticExpr ::= BinaryArithmeticExpr | ArithmeticTerm BinaryArithmeticExpr ::= ArithmeticTerm _? ( '+' | '-' ) _? ArithmeticExpr ArithmeticTerm ::= HighArithmeticExpr HighArithmeticExpr ::= BinaryHighArithmeticExpr | HighArithmeticTerm BinaryHighArithmeticExpr ::= HighArithmeticTerm _? ( '*' | '/' | '%' ) _? HighArithmeticExpr HighArithmeticTerm ::= EagerExpr | LazyExpr | CallExpr | DataObjectExpr | ListExpr | SubExpr | Literal | FeatureExpr FeatureExpr ::= Feature Feature ::= Symbol ( '.' Symbol )* Literal ::= Number | String | 'true' | 'false' | 'null' ConstantString ::= String Number ::= FloatLiteral | IntLiteral String ::= QuoteString ( _ QuoteString )* FinalWhitespace ::= _? UnterminatedComment? _ ::= ( Whitespace | Comment )+ QuoteString ::= SingleQuoteString | DoubleQuoteString SingleQuoteString ::= "'" SingleQuoteStringChar* "'" DoubleQuoteString ::= '"' DoubleQuoteStringChar* '"' SingleQuoteStringChar ::= SingleQuoteStringCharUnescaped | StringEscapedChar DoubleQuoteStringChar ::= DoubleQuoteStringCharUnescaped | StringEscapedChar StringEscapedChar ::= '\' ( '"' | "'" | '\' | '/' | 'b' | 'f' | 'n' | 'r' | 't' | 'u' $ HexDigit HexDigit HexDigit HexDigit ) <?TOKENS?> CustomCallSource ::= $ ( String | . - [()] | '(' CustomCallSource ')' )* Symbol ::= [A-Za-z0-9_]+ Func ::= [A-Za-z0-9_]+ IntLiteral ::= '0' | '-'? [1-9] [0-9]* FloatLiteral ::= '-'? [0-9]* '.' [0-9]+ Whitespace ::= [ #x9#xA#xD] Comment ::= UnterminatedComment #xA+ UnterminatedComment ::= ( '#' | '--' ) [^#xA]* DoubleQuoteStringCharUnescaped ::= [^"\#x0-#x1F] SingleQuoteStringCharUnescaped ::= [^'\#x0-#x1F] HexDigit ::= [0-9a-f]
Notice that the EBNF shown above omit the information that SQRL is a case insensitive language.
SQRL
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.