You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 Sun Feb 26, 2023, 17:44 (UTC+01) by bison-to-w3c v0.62 which is Copyright (c) 2011-2022 by Gunther Rademacher <[email protected]> */
// From: https://github.com/UoYCS-plasma/GP2/blob/master/src/parser.y
Initialise
::= GP_PROGRAM Declaration+
| GP_GRAPH HostGraph
| GP_RULE RuleDecl
Declaration
::= MainDecl
| ProcDecl
| RuleDecl
MainDecl ::= MAIN '=' ComSeq
ProcDecl ::= ( ProcID '=' ( '[' LocalDecls ']' )? | RuleID '=' '[' LocalDecls ']' ) ComSeq
LocalDecls
::= ( RuleDecl | ProcDecl )*
ComSeq ::= Command ( ( ';' | ',' ) Command )*
Command ::= ( Block OR | IF Block ( THEN ( Block ELSE )? | ELSE ) | TRY ( Block THEN )? ( Block ELSE )? )? Block
Block ::= ( '(' ComSeq ')' | SimpleCommand ) '!'?
| error ')'
| SKIP
| FAIL
| BREAK
SimpleCommand
::= RuleSetCall
| RuleID
| ProcID
RuleSetCall
::= ( '{' ( RuleID | ProcID ) ( ( ',' | ';' ) RuleID )* | error ) '}'
RuleDecl ::= ( RuleID '(' ( VarDecls ';'? )? | ProcID '(' VarDecls ) ')' Graph ARROW Graph Inter CondDecl
VarDecls ::= VarList ':' Type ( ';' VarList ':' Type )*
VarList ::= Variable ( ',' Variable )*
Inter ::= ( INTERFACE '=' '{' ( NodeID ( ',' NodeID )* )? | error ) '}'
Type ::= INT
| CHARACTER
| STRING
| ATOM
| LIST
Graph ::= '[' ( Position '|' )? ( '|' | NodeList '|' EdgeList? ) ']'
NodeList ::= Node+
Node ::= '(' NodeID RootNode ',' Label Position? ')'
EdgeList ::= Edge+
Edge ::= '(' EdgeID Bidirection ',' NodeID ',' NodeID ',' Label ')'
Position ::= '<' ( DNUM ',' ( DNUM | '-'? NUM ) | '-'? NUM ',' ( '-'? NUM | DNUM ) ) '>'
RootNode ::= ROOT?
Bidirection
::= BIDIRECTIONAL?
CondDecl ::= ( WHERE Condition )?
Condition
::= ( Subtype '(' Variable | EDGETEST '(' NodeID ',' NodeID LabelArg | '(' Condition ) ')'
| List ( '=' | NEQ ) List
| AtomExp ( '>' | GTEQ | '<' | LTEQ ) AtomExp
| ( NOT | Condition ( OR | AND ) ) Condition
Subtype ::= INT
| CHARACTER
| STRING
| ATOM
LabelArg ::= ( ',' Label )?
Label ::= List ( '#' ( MARK | ANY_MARK ) )?
List ::= ( AtomExp | _EMPTY ) ( ':' ( AtomExp | _EMPTY ) )*
AtomExp ::= Variable
| NUM
| STR
| ( ( INDEG | OUTDEG ) '(' NodeID | _LENGTH '(' Variable | '(' AtomExp ) ')'
| ( '-' | AtomExp ( '+' | '-' | '*' | '/' | '.' ) ) AtomExp
ProcID ::= PROCID
RuleID ::= ID
NodeID ::= ID
| NUM
EdgeID ::= ID
| NUM
Variable ::= ID
HostGraph
::= '[' ( Position '|' )? ( '|' | HostNodeList '|' HostEdgeList? ) ']'
HostNodeList
::= HostNode+
HostNode ::= '(' HostID RootNode ',' HostLabel Position? ')'
HostEdgeList
::= HostEdge+
HostEdge ::= '(' HostID ',' HostID ',' HostID ',' HostLabel ')'
HostID ::= NUM
HostLabel
::= HostList ( '#' MARK )?
HostList ::= ( HostExp | _EMPTY ) ( ':' ( HostExp | _EMPTY ) )*
HostExp ::= '-'? NUM
| STR
// Tokens
//\(\S+\)\s+return \(\S[^;]+\);
/* GP2 keywords */
MAIN ::= "Main"
IF ::= "if"
TRY ::= "try"
THEN ::= "then"
ELSE ::= "else"
SKIP ::= "skip"
FAIL ::= "fail"
BREAK ::= "break"
WHERE ::= "where"
AND ::= "and"
OR ::= "or"
NOT ::= "not"
EDGETEST ::= "edge"
INDEG ::= "indeg"
OUTDEG ::= "outdeg"
INTERFACE ::= "interface"
_EMPTY ::= "empty"
_LENGTH ::= "length"
/* Keywords for node and edge marks */
MARK ::= "red" | "green" | "blue" | "grey" | "dashed"
/* Any has a distinct token since it cannot appear in the host graph and
therefore must be distinguished from the other marks. */
ANY_MARK ::= "any"
/* Keywords for GP2 types */
INT ::= "int"
CHARACTER ::= "char"
STRING ::= "string"
ATOM ::= "atom"
LIST ::= "list"
ARROW ::= "=>"
ROOT ::= "(R)"
BIDIRECTIONAL ::= "(B)"
NEQ ::= "!="
GTEQ ::= ">="
LTEQ ::= "<="
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: