[1] n3Doc ::= ( ( n3Statement ".") | sparqlDirective) *
[2] n3Statement ::= n3Directive | triples
[3] n3Directive ::= prefixID | base
[4] sparqlDirective ::= sparqlBase | sparqlPrefix
[5] sparqlBase ::= BASE IRIREF
[6] sparqlPrefix ::= PREFIX PNAME_NS IRIREF
[7] prefixID ::= "@prefix" PNAME_NS IRIREF
[8] base ::= "@base" IRIREF
[9] triples ::= subject predicateObjectList?
[10] predicateObjectList ::= verb objectList ( ";" ( verb objectList) ? ) *
[11] objectList ::= object ( "," object) *
[12] verb ::= predicate | "a" | ( "has" expression) | ( "is" expression "of") | "=" | "<=" | "=>"
[13] subject ::= expression
[14] predicate ::= expression | ( "<-" expression)
[15] object ::= expression
[16] expression ::= path
[17] path ::= pathItem ( ( "!" path) | ( "^" path) ) ?
[18] pathItem ::= iri | blankNode | quickVar | collection | blankNodePropertyList | iriPropertyList | literal | formula
[19] literal ::= rdfLiteral | numericLiteral | BOOLEAN_LITERAL
[20] blankNodePropertyList ::= "[" predicateObjectList "]"
[21] iriPropertyList ::= IPLSTART iri predicateObjectList "]"
[22] collection ::= "(" object* ")"
[23] formula ::= "{" formulaContent? "}"
[24] formulaContent ::= ( n3Statement ( "." formulaContent? ) ? ) | ( sparqlDirective formulaContent? )
[25] numericLiteral ::= DOUBLE | DECIMAL | INTEGER
[26] rdfLiteral ::= STRING ( LANGTAG | ( "^^" iri) ) ?
[27] iri ::= IRIREF | prefixedName
[28] prefixedName ::= PNAME_LN | PNAME_NS
[29] blankNode ::= BLANK_NODE_LABEL | ANON
[30] quickVar ::= QUICK_VAR_NAME
@terminals # Productions for terminals
[31] BOOLEAN_LITERAL ::= "true" | "false"
[32] STRING ::= STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE | STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE
[33] IPLSTART ::= "[" WS* "id"
[139s] IRIREF ::= "<" ( ( [ ^<>"{}|^`\] - [ #x00-#x20] ) | UCHAR) * ">"
[140s] PNAME_NS ::= PN_PREFIX? ":"
[141s] PNAME_LN ::= PNAME_NS PN_LOCAL
[142s] BLANK_NODE_LABEL ::= "_:" ( PN_CHARS_U | [ 0-9] ) ( ( PN_CHARS | ".") * PN_CHARS) ?
[145s] LANGTAG ::= "@" ( [ a-zA-Z] + ( "-" [ a-zA-Z0-9] + ) * )
[146s] INTEGER ::= [ 0-9] +
[147s] DECIMAL ::= [ 0-9] * "." [ 0-9] +
[148s] DOUBLE ::= ( [ 0-9] + "." [ 0-9] * EXPONENT) | ( "." [ 0-9] + EXPONENT) | ( [ 0-9] + EXPONENT)
[155s] EXPONENT ::= [ eE] [ +-] ? [ 0-9] +
[156s] STRING_LITERAL_QUOTE ::= '"' ( [ ^>"#x5C#x0A#x0D] | ECHAR | UCHAR) * '"'
[157s] STRING_LITERAL_SINGLE_QUOTE ::= "'" ( [ ^#x27#x5C#x0A#x0D] | ECHAR | UCHAR) * "'"
[158s] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" ( ( "'" | "''") ? ( [ ^'\] | ECHAR | UCHAR) ) * "'''"
[159s] STRING_LITERAL_LONG_QUOTE ::= '"""' ( ( '"' | '""') ? ( [ ^"\] | ECHAR | UCHAR) ) * '"""'
[35] UCHAR ::= ( "\u" HEX HEX HEX HEX) | ( "\U" HEX HEX HEX HEX HEX HEX HEX HEX)
[160s] ECHAR ::= "\" [ tbnrf\"']
[162s] WS ::= #x20 | #x09 | #x0D | #x0A
[163s] ANON ::= "[" WS* "]"
[36] QUICK_VAR_NAME ::= "?" PN_LOCAL
[164s] PN_CHARS_BASE ::= [ A-Z]
| [ a-z]
| [ #xC0-#xD6]
| [ #xD8-#xF6]
| [ #xF8-#x02FF]
| [ #x0370-#x037D]
| [ #x037F-#x1FFF]
| [ #x200C-#x200D]
| [ #x2070-#x218F]
| [ #x2C00-#x2FEF]
| [ #x3001-#xD7FF]
| [ #xF900-#xFDCF]
| [ #xFDF0-#xFFFD]
| [ #x00010000-#x000EFFFF]
[165s] PN_CHARS_U ::= PN_CHARS_BASE | "_"
[167s] PN_CHARS ::= PN_CHARS_U | "-" | [ 0-9] | #xB7 | [ #x0300-#x036F] | [ #x203F-#x2040]
[37] BASE ::= ( "B" | "b") ( "A" | "a") ( "S" | "s") ( "E" | "e")
[38] PREFIX ::= ( "P" | "p") ( "R" | "r") ( "E" | "e") ( "F" | "f") ( "I" | "i") ( "X" | "x")
[168s] PN_PREFIX ::= PN_CHARS_BASE ( ( PN_CHARS | ".") * PN_CHARS) ?
[169s] PN_LOCAL ::= ( PN_CHARS_U | ":" | [ 0-9] | PLX) ( ( PN_CHARS | "." | ":" | PLX) * ( PN_CHARS | ":" | PLX) ) ?
[170s] PLX ::= PERCENT | PN_LOCAL_ESC
[171s] PERCENT ::= "%" HEX HEX
[172s] HEX ::= [ 0-9] | [ A-F] | [ a-f]
[173s] PN_LOCAL_ESC ::= "\" ( "_" | "~" | "." | "-" | "!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=" | "/" | "?" | "#" | "@" | "%")
[39] COMMENT ::= ( "#" - "#x") [ ^#x0A#x0C#x0D] *
@pass ( WS | COMMENT) *