# Convert BNF in RDF to HTML # @prefix rdf: . @prefix rdfs: . @prefix bnf: . @prefix rul: . @prefix : . @prefix h: . @prefix log: . @prefix string: . @keywords a, is, of. ("0" 0) log:outputString """ BNF

BNF

Productions are in normal type, linked to their definitions.
Regular expressions are in italics
Literal characters in quoted in bold
void means an empty production.

""". ("~~" 9) log:outputString """
""". # Find all possible sequences for each term # { ?x bnf:mustBeOneSequence ?y} => { ?x optionTail ?y; a Production}. { ?x bnf:matches [] } => { ?x a Production}. {?x optionTail [rdf:first ?y; rdf:rest ?z]} => { ?x bnf:canBeSequence ?y; optionTail ?z. ?y a Sequence}. # Label every trailing subseqeunce { ?seq a Sequence } => { ?seq a SequenceTail }. { ?seq a SequenceTail; rdf:rest ?s2 } => { ?s2 a SequenceTail }. # Literal are referenced but no labels for LHS @@ escaped { ?seq a SequenceTail; rdf:first ?x. ?x log:rawType log:Literal. ( "\"" ?x "\"" ) string:concatenation ?ref. } => { ?x reference ?ref }. ############ { ?x a Production. ?x log:uri ?u. (?u ".*#(.*)") string:scrape ?lab. } => { ?x bnf:label ?lab. }. { ?x a Production; bnf:label ?lab. ( "" ?lab "" ) string:concatenation ?ref. ( "
" ?lab "
\n" ) string:concatenation ?start. } => { ?x reference ?ref. (?lab 0) log:outputString ?start. (?lab 9) log:outputString "\t
\n". }. ############ () seqlabel "void". bnf:eof reference "EOF". # Start it, skipping use of the seqlabel of (): { ?seq a SequenceTail; rdf:first ?x; rdf:rest (). ?x reference ?lab1. } => { ?seq seqlabel ?lab1 }. # This one takes forever: { ?seq a SequenceTail; rdf:first ?x; rdf:rest ?tail. ?x reference ?lab1. ?tail seqlabel ?lab2; rdf:rest []. # Non-null (?lab1 " " ?lab2) string:concatenation ?str } => { ?seq seqlabel ?str }. {?x bnf:label ?lab; bnf:canBeSequence [seqlabel ?seqlab]. ("\t\t

" ?seqlab "

\n" ) string:concatenation ?para } => {(?lab 5) log:outputString ?para}. { [] a Production; bnf:label ?lab; bnf:matches ?regexp. ( "\t

" ?regexp "

\n") string:concatenation ?regpara. }=>{ (?lab 6) log:outputString ?regpara. }. #end