N-Triples grammar in HTML
authorGavin Carothers <gavin@carothers.name>
Wed, 25 Apr 2012 17:56:38 -0700
changeset 260 559916600db6
parent 258 507998a7685b
child 261 0ca15dfa86db
N-Triples grammar in HTML
rdf-turtle/index.html
rdf-turtle/n-prime-bnf.html
rdf-turtle/n-prime.bnf
--- a/rdf-turtle/index.html	Wed Apr 25 17:00:33 2012 -0700
+++ b/rdf-turtle/index.html	Wed Apr 25 17:56:38 2012 -0700
@@ -1245,8 +1245,8 @@
           <p>A N-Triples document is a Unicode[[!UNICODE]] character string encoded in UTF-8.
           Unicode codepoints only in the range U+0 to U+10FFFF inclusive are allowed.</p>
           <p><a href="#sec-strings">Escape sequence rules</a> are the same as Turtle. However, as only the <code>STRING_LITERAL2</code> production is allowed new lines in literals MUST be escaped.</p>
-          <pre data-include="n-prime.bnf" data-oninclude="esc">
-          </pre>
+          <div data-include="n-prime-bnf.html">
+          </div>
         </section>
       </section>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf-turtle/n-prime-bnf.html	Wed Apr 25 17:56:38 2012 -0700
@@ -0,0 +1,112 @@
+<table class="grammar">
+    <tbody>
+            <tr id="grammar-production-ntriplesDoc" data-grammar-original="[1]  ntriplesDoc             ::= triple? (EOL triple)* EOL?" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;?&#x27;, (&#x27;id&#x27;, &#x27;triple&#x27;)), (&#x27;*&#x27;, (&#x27;,&#x27;, [(&#x27;id&#x27;, &#x27;EOL&#x27;), (&#x27;id&#x27;, &#x27;triple&#x27;)])), (&#x27;?&#x27;, (&#x27;id&#x27;, &#x27;EOL&#x27;))])" >
+    <td>[1]<td>
+    <td><code>ntriplesDoc</code><td>
+    <td>::=</td>
+    <td>(<a href='#grammar-production-triple'>triple</a>)? (<a href='#grammar-production-EOL'>EOL</a> <a href='#grammar-production-triple'>triple</a>)<code class='grammar-star'>*</code> (<a href='#grammar-production-EOL'>EOL</a>)?</td>
+</tr>
+            <tr id="grammar-production-triple" data-grammar-original="[2]  triple                  ::= subj pred obj &#x27;.&#x27;" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;id&#x27;, &#x27;subj&#x27;), (&#x27;id&#x27;, &#x27;pred&#x27;), (&#x27;id&#x27;, &#x27;obj&#x27;), (&quot;&#x27;&quot;, &#x27;.&#x27;)])" >
+    <td>[2]<td>
+    <td><code>triple</code><td>
+    <td>::=</td>
+    <td><a href='#grammar-production-subj'>subj</a> <a href='#grammar-production-pred'>pred</a> <a href='#grammar-production-obj'>obj</a> '<code class='grammar-literal'>.</code>'</td>
+</tr>
+            <tr id="grammar-production-subj" data-grammar-original="[3]  subj                    ::= IRI_REF | BLANK_NODE_LABEL" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;IRI_REF&#x27;), (&#x27;id&#x27;, &#x27;BLANK_NODE_LABEL&#x27;)])" >
+    <td>[3]<td>
+    <td><code>subj</code><td>
+    <td>::=</td>
+    <td>(<a href='#grammar-production-IRI_REF'>IRI_REF</a> <code>|</code> <a href='#grammar-production-BLANK_NODE_LABEL'>BLANK_NODE_LABEL</a>)</td>
+</tr>
+            <tr id="grammar-production-pred" data-grammar-original="[4]  pred                    ::= IRI_REF" data-grammar-expression="(&#x27;id&#x27;, &#x27;IRI_REF&#x27;)" >
+    <td>[4]<td>
+    <td><code>pred</code><td>
+    <td>::=</td>
+    <td><a href='#grammar-production-IRI_REF'>IRI_REF</a></td>
+</tr>
+            <tr id="grammar-production-obj" data-grammar-original="[5]  obj                     ::= IRI_REF | BLANK_NODE_LABEL | lit" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;IRI_REF&#x27;), (&#x27;id&#x27;, &#x27;BLANK_NODE_LABEL&#x27;), (&#x27;id&#x27;, &#x27;lit&#x27;)])" >
+    <td>[5]<td>
+    <td><code>obj</code><td>
+    <td>::=</td>
+    <td>(<a href='#grammar-production-IRI_REF'>IRI_REF</a> <code>|</code> <a href='#grammar-production-BLANK_NODE_LABEL'>BLANK_NODE_LABEL</a> <code>|</code> <a href='#grammar-production-lit'>lit</a>)</td>
+</tr>
+            <tr id="grammar-production-lit" data-grammar-original="[6]  lit                     ::= STRING_LITERAL2 (&#x27;^^&#x27; IRI_REF | (&#x27;@&#x27; LANG) )?" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;id&#x27;, &#x27;STRING_LITERAL2&#x27;), (&#x27;?&#x27;, (&#x27;|&#x27;, [(&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;^^&#x27;), (&#x27;id&#x27;, &#x27;IRI_REF&#x27;)]), (&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;@&#x27;), (&#x27;id&#x27;, &#x27;LANG&#x27;)])]))])" >
+    <td>[6]<td>
+    <td><code>lit</code><td>
+    <td>::=</td>
+    <td><a href='#grammar-production-STRING_LITERAL2'>STRING_LITERAL2</a> (('<code class='grammar-literal'>^^</code>' <a href='#grammar-production-IRI_REF'>IRI_REF</a> <code>|</code> '<code class='grammar-literal'>@</code>' <a href='#grammar-production-LANG'>LANG</a>))?</td>
+</tr>
+            <tr id="grammar-production-LANG" data-grammar-original="[7]  LANG                    ::= [a-zA-Z]+ ( &quot;-&quot; [a-zA-Z0-9]+ )*" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;+&#x27;, (&#x27;[&#x27;, &#x27;a-zA-Z&#x27;)), (&#x27;*&#x27;, (&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;-&#x27;), (&#x27;+&#x27;, (&#x27;[&#x27;, &#x27;a-zA-Z0-9&#x27;))]))])" class='grammar-token'>
+    <td>[7]<td>
+    <td><code>LANG</code><td>
+    <td>::=</td>
+    <td>([<code class='grammar-chars'>a-zA-Z</code>])<code class='grammar-plus'>+</code> ('<code class='grammar-literal'>-</code>' ([<code class='grammar-chars'>a-zA-Z0-9</code>])<code class='grammar-plus'>+</code>)<code class='grammar-star'>*</code></td>
+</tr>
+            <tr id="grammar-production-EOL" data-grammar-original="[8]  EOL                     ::= [\r\n]+" data-grammar-expression="(&#x27;+&#x27;, (&#x27;[&#x27;, &#x27;\\r\\n&#x27;))" class='grammar-token'>
+    <td>[8]<td>
+    <td><code>EOL</code><td>
+    <td>::=</td>
+    <td>([<code class='grammar-chars'>\r\n</code>])<code class='grammar-plus'>+</code></td>
+</tr>
+            <tr id="grammar-production-IRI_REF" data-grammar-original="[70s] IRI_REF           ::= &#x27;&lt;&#x27; ([^&lt;&gt;&quot;{}|^`\]-[#x00-#x20] | UCHAR )* &#x27;&gt;&#x27;" data-grammar-expression="(&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;&lt;&#x27;), (&#x27;*&#x27;, (&#x27;|&#x27;, [(&#x27;-&#x27;, [(&#x27;[&#x27;, &#x27;^&lt;&gt;&quot;{}|^`\\&#x27;), (&#x27;[&#x27;, &#x27;#x00-#x20&#x27;)]), (&#x27;id&#x27;, &#x27;UCHAR&#x27;)])), (&quot;&#x27;&quot;, &#x27;&gt;&#x27;)])" class='grammar-token'>
+    <td>[70s]<td>
+    <td><code>IRI_REF</code><td>
+    <td>::=</td>
+    <td>'<code class='grammar-literal'>&lt;</code>' (([<code class='grammar-chars'>^<>"{}|^`\</code>]<code class='grammar-diff'>-</code>[<code class='grammar-chars'>#x00-#x20</code>] <code>|</code> <a href='#grammar-production-UCHAR'>UCHAR</a>))<code class='grammar-star'>*</code> '<code class='grammar-literal'>&gt;</code>'</td>
+</tr>
+            <tr id="grammar-production-BLANK_NODE_LABEL" data-grammar-original="[73s] BLANK_NODE_LABEL  ::= &quot;_:&quot; PN_LOCAL" data-grammar-expression="(&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;_:&#x27;), (&#x27;id&#x27;, &#x27;PN_LOCAL&#x27;)])" class='grammar-token'>
+    <td>[73s]<td>
+    <td><code>BLANK_NODE_LABEL</code><td>
+    <td>::=</td>
+    <td>'<code class='grammar-literal'>_:</code>' <a href='#grammar-production-PN_LOCAL'>PN_LOCAL</a></td>
+</tr>
+            <tr id="grammar-production-STRING_LITERAL2" data-grammar-original="[88s] STRING_LITERAL2   ::= &#x27;&quot;&#x27; ( ( [^\&quot;\\\n\r] ) | ECHAR | UCHAR )* &#x27;&quot;&#x27;" data-grammar-expression="(&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;&quot;&#x27;), (&#x27;*&#x27;, (&#x27;|&#x27;, [(&#x27;[&#x27;, &#x27;^\\&quot;\\\\\\n\\r&#x27;), (&#x27;id&#x27;, &#x27;ECHAR&#x27;), (&#x27;id&#x27;, &#x27;UCHAR&#x27;)])), (&quot;&#x27;&quot;, &#x27;&quot;&#x27;)])" class='grammar-token'>
+    <td>[88s]<td>
+    <td><code>STRING_LITERAL2</code><td>
+    <td>::=</td>
+    <td>'<code class='grammar-literal'>&quot;</code>' (([<code class='grammar-chars'>^\"\\\n\r</code>] <code>|</code> <a href='#grammar-production-ECHAR'>ECHAR</a> <code>|</code> <a href='#grammar-production-UCHAR'>UCHAR</a>))<code class='grammar-star'>*</code> '<code class='grammar-literal'>&quot;</code>'</td>
+</tr>
+            <tr id="grammar-production-UCHAR" data-grammar-original="[19]  UCHAR             ::= ( &quot;\\u&quot; HEX HEX HEX HEX )| ( &quot;\\U&quot; HEX HEX HEX HEX HEX HEX HEX HEX )" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;\\\\u&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;)]), (&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;\\\\U&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;), (&#x27;id&#x27;, &#x27;HEX&#x27;)])])" class='grammar-token'>
+    <td>[19]<td>
+    <td><code>UCHAR</code><td>
+    <td>::=</td>
+    <td>('<code class='grammar-literal'>\\u</code>' <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <code>|</code> '<code class='grammar-literal'>\\U</code>' <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a> <a href='#grammar-production-HEX'>HEX</a>)</td>
+</tr>
+            <tr id="grammar-production-ECHAR" data-grammar-original="[91s] ECHAR             ::= &quot;\\&quot; [tbnrf\\\&quot;&#x27;]" data-grammar-expression="(&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;\\\\&#x27;), (&#x27;[&#x27;, &#x27;tbnrf\\\\\\&quot;\&#x27;&#x27;)])" class='grammar-token'>
+    <td>[91s]<td>
+    <td><code>ECHAR</code><td>
+    <td>::=</td>
+    <td>'<code class='grammar-literal'>\\</code>' [<code class='grammar-chars'>tbnrf\\\"'</code>]</td>
+</tr>
+            <tr id="grammar-production-PN_CHARS_BASE" data-grammar-original="[95s] PN_CHARS_BASE     ::= [A-Z]| [a-z]| [#00C0-#00D6]| [#00D8-#00F6]| [#00F8-#02FF]| [#0370-#037D]| [#037F-#1FFF]| [#200C-#200D]| [#2070-#218F]| [#2C00-#2FEF]| [#3001-#D7FF]| [#F900-#FDCF]| [#FDF0-#FFFD]| [#10000-#EFFFF]" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;[&#x27;, &#x27;A-Z&#x27;), (&#x27;[&#x27;, &#x27;a-z&#x27;), (&#x27;[&#x27;, &#x27;#00C0-#00D6&#x27;), (&#x27;[&#x27;, &#x27;#00D8-#00F6&#x27;), (&#x27;[&#x27;, &#x27;#00F8-#02FF&#x27;), (&#x27;[&#x27;, &#x27;#0370-#037D&#x27;), (&#x27;[&#x27;, &#x27;#037F-#1FFF&#x27;), (&#x27;[&#x27;, &#x27;#200C-#200D&#x27;), (&#x27;[&#x27;, &#x27;#2070-#218F&#x27;), (&#x27;[&#x27;, &#x27;#2C00-#2FEF&#x27;), (&#x27;[&#x27;, &#x27;#3001-#D7FF&#x27;), (&#x27;[&#x27;, &#x27;#F900-#FDCF&#x27;), (&#x27;[&#x27;, &#x27;#FDF0-#FFFD&#x27;), (&#x27;[&#x27;, &#x27;#10000-#EFFFF&#x27;)])" class='grammar-token'>
+    <td>[95s]<td>
+    <td><code>PN_CHARS_BASE</code><td>
+    <td>::=</td>
+    <td>([<code class='grammar-chars'>A-Z</code>] <code>|</code> [<code class='grammar-chars'>a-z</code>] <code>|</code> [<code class='grammar-chars'>#00C0-#00D6</code>] <code>|</code> [<code class='grammar-chars'>#00D8-#00F6</code>] <code>|</code> [<code class='grammar-chars'>#00F8-#02FF</code>] <code>|</code> [<code class='grammar-chars'>#0370-#037D</code>] <code>|</code> [<code class='grammar-chars'>#037F-#1FFF</code>] <code>|</code> [<code class='grammar-chars'>#200C-#200D</code>] <code>|</code> [<code class='grammar-chars'>#2070-#218F</code>] <code>|</code> [<code class='grammar-chars'>#2C00-#2FEF</code>] <code>|</code> [<code class='grammar-chars'>#3001-#D7FF</code>] <code>|</code> [<code class='grammar-chars'>#F900-#FDCF</code>] <code>|</code> [<code class='grammar-chars'>#FDF0-#FFFD</code>] <code>|</code> [<code class='grammar-chars'>#10000-#EFFFF</code>])</td>
+</tr>
+            <tr id="grammar-production-PN_CHARS_U" data-grammar-original="[96s] PN_CHARS_U        ::= PN_CHARS_BASE| &quot;_&quot;" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;PN_CHARS_BASE&#x27;), (&quot;&#x27;&quot;, &#x27;_&#x27;)])" class='grammar-token'>
+    <td>[96s]<td>
+    <td><code>PN_CHARS_U</code><td>
+    <td>::=</td>
+    <td>(<a href='#grammar-production-PN_CHARS_BASE'>PN_CHARS_BASE</a> <code>|</code> '<code class='grammar-literal'>_</code>')</td>
+</tr>
+            <tr id="grammar-production-PN_CHARS" data-grammar-original="[98s] PN_CHARS          ::= PN_CHARS_U| &quot;-&quot;| [0-9]| #00B7| [#0300-#036F]| [#203F-#2040]" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;PN_CHARS_U&#x27;), (&quot;&#x27;&quot;, &#x27;-&#x27;), (&#x27;[&#x27;, &#x27;0-9&#x27;), (&#x27;#&#x27;, &#x27;#00B7&#x27;), (&#x27;[&#x27;, &#x27;#0300-#036F&#x27;), (&#x27;[&#x27;, &#x27;#203F-#2040&#x27;)])" class='grammar-token'>
+    <td>[98s]<td>
+    <td><code>PN_CHARS</code><td>
+    <td>::=</td>
+    <td>(<a href='#grammar-production-PN_CHARS_U'>PN_CHARS_U</a> <code>|</code> '<code class='grammar-literal'>-</code>' <code>|</code> [<code class='grammar-chars'>0-9</code>] <code>|</code> <code class='grammar-char-escape'>#00B7</code> <code>|</code> [<code class='grammar-chars'>#0300-#036F</code>] <code>|</code> [<code class='grammar-chars'>#203F-#2040</code>])</td>
+</tr>
+            <tr id="grammar-production-PN_LOCAL" data-grammar-original="[100s] PN_LOCAL         ::= ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | &quot;.&quot; )* PN_CHARS )?" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;PN_CHARS_U&#x27;), (&#x27;[&#x27;, &#x27;0-9&#x27;)]), (&#x27;?&#x27;, (&#x27;,&#x27;, [(&#x27;*&#x27;, (&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;PN_CHARS&#x27;), (&quot;&#x27;&quot;, &#x27;.&#x27;)])), (&#x27;id&#x27;, &#x27;PN_CHARS&#x27;)]))])" class='grammar-token'>
+    <td>[100s]<td>
+    <td><code>PN_LOCAL</code><td>
+    <td>::=</td>
+    <td>(<a href='#grammar-production-PN_CHARS_U'>PN_CHARS_U</a> <code>|</code> [<code class='grammar-chars'>0-9</code>]) (((<a href='#grammar-production-PN_CHARS'>PN_CHARS</a> <code>|</code> '<code class='grammar-literal'>.</code>'))<code class='grammar-star'>*</code> <a href='#grammar-production-PN_CHARS'>PN_CHARS</a>)?</td>
+</tr>
+            <tr id="grammar-production-HEX" data-grammar-original="[162s] HEX              ::= [0-9] | [A-F] | [a-f]" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;[&#x27;, &#x27;0-9&#x27;), (&#x27;[&#x27;, &#x27;A-F&#x27;), (&#x27;[&#x27;, &#x27;a-f&#x27;)])" class='grammar-token'>
+    <td>[162s]<td>
+    <td><code>HEX</code><td>
+    <td>::=</td>
+    <td>([<code class='grammar-chars'>0-9</code>] <code>|</code> [<code class='grammar-chars'>A-F</code>] <code>|</code> [<code class='grammar-chars'>a-f</code>])</td>
+</tr>
+    </tbody>
+</table>
--- a/rdf-turtle/n-prime.bnf	Wed Apr 25 17:00:33 2012 -0700
+++ b/rdf-turtle/n-prime.bnf	Wed Apr 25 17:56:38 2012 -0700
@@ -1,16 +1,15 @@
-ntriplesDoc             ::= triple? (EOL triple)* EOL?
-triple                  ::= subj pred obj '.'
-subj                    ::= IRI_REF | BLANK_NODE_LABEL
-pred                    ::= IRI_REF 
-obj                     ::= IRI_REF | BLANK_NODE_LABEL | lit
-lit                     ::= STRING_LITERAL2 ('^^' IRI_REF | ('@' LANG) )?
+[1]  ntriplesDoc             ::= triple? (EOL triple)* EOL?
+[2]  triple                  ::= subj pred obj '.'
+[3]  subj                    ::= IRI_REF | BLANK_NODE_LABEL
+[4]  pred                    ::= IRI_REF 
+[5]  obj                     ::= IRI_REF | BLANK_NODE_LABEL | lit
+[6]  lit                     ::= STRING_LITERAL2 ('^^' IRI_REF | ('@' LANG) )?
 
 @terminals
-LANG                    ::= [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )*
+[7]  LANG                    ::= [a-zA-Z]+ ( "-" [a-zA-Z0-9]+ )*
 
-EOL                     ::= [\r\n]+
+[8]  EOL                     ::= [\r\n]+
 
-/* From Turtle */
 [70s] IRI_REF           ::= '<' ([^<>"{}|^`\]-[#x00-#x20] | UCHAR )* '>'
 [73s] BLANK_NODE_LABEL  ::= "_:" PN_LOCAL 
 [88s] STRING_LITERAL2   ::= '"' ( ( [^\"\\\n\r] ) | ECHAR | UCHAR )* '"' 
@@ -40,6 +39,4 @@
                           | [#0300-#036F] 
                           | [#203F-#2040] 
 [100s] PN_LOCAL         ::= ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | "." )* PN_CHARS )?
-[162s] HEX              ::= [0-9] | [A-F] | [a-f]
-
-@pass                   ::= [ \t]+ | "#" [^\r\n]* [\r\n]
\ No newline at end of file
+[162s] HEX              ::= [0-9] | [A-F] | [a-f]
\ No newline at end of file