Re: Cheap and cheerful railroad diagrams

Norm Tovey-Walsh <norm@saxonica.com> writes:
> Here’s ixml.ebnf that you can paste into the RR tool to see the
> diagrams:

Sorry. Stylesheet was not distinguishing repeat0 and repeat1 correctly.
This is better, but I observe that in the RR diagrams, a right hand side
that consists of a single string is inlined. That’s not me.

ixml ::= (s prolog? rule (RS rule)* s)
s ::=  (whitespace | comment)* 
RS ::=  (whitespace | comment)+ 
whitespace ::=  "INCL: Zs" | tab | lf | cr 
tab ::=  '#x9' 
lf ::=  '#xa' 
cr ::=  '#xd' 
comment ::= ('{' (cchar | comment)* '}')
cchar ::=  'EXCL: "{}"' 
prolog ::= (version s)
version ::= ('ixml' RS 'version' RS string s '.')
rule ::= (((mark s))? name s 'INCL: "=:"' s alts '.')
mark ::=  'INCL: "@^-"' 
alts ::=  alt (('INCL: ";|"' s) alt)* 
alt ::= (term ((',' s) term)*)? 
term ::=  factor | option | repeat0 | repeat1 
factor ::=  terminal | nonterminal | insertion | ('(' s alts ')' s)
repeat0 ::= (factor('*' s) | ('**' s sep))
repeat1 ::= (factor('+' s) | ('++' s sep))
option ::= (factor '?' s)
sep ::=  factor 
nonterminal ::= (((mark s))? name s)
name ::= (namestart (namefollower)* )
namestart ::=  'INCL: "_" | L' 
namefollower ::=  namestart | 'INCL: "-.·‿⁀" | Nd | Mn' 
terminal ::=  literal | charset 
literal ::=  quoted | encoded 
quoted ::= (((tmark s))? string s)
tmark ::=  'INCL: "^-"' 
string ::= ('"' (dchar)+ '"') | (''' (schar)+ ''')
dchar ::=  "EXCL: '#22' | #xa | #xd" | ('"' '"')
schar ::=  "EXCL: #22'#22 | #xa | #xd" | (''' ''')
encoded ::= (((tmark s))? '#' hex s)
hex ::=  ("INCL: [0-9] | [a-f] | [A-F]")+ 
charset ::=  inclusion | exclusion 
inclusion ::= (((tmark s))? set)
exclusion ::= (((tmark s))? '~' s set)
set ::= ('[' s((member s) (('INCL: ";|"' s) (member s))*)? ']' s)
member ::=  string | ('#' hex) | range | class 
range ::= (from s '-' s to)
from ::=  character 
to ::=  character 
character ::= ('"' dchar '"') | (''' schar ''') | ('#' hex)
class ::=  code 
code ::= (capital letter? )
capital ::=  "INCL: [A-Z]" 
letter ::=  "INCL: [a-z]" 
insertion ::= ('+' s string | ('#' hex)s)

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Thursday, 1 September 2022 10:51:46 UTC