turtleDoc ::= statement*
statement ::= directive | (triples '.')
directive ::= prefixID | base | sparqlPrefix | sparqlBase
prefixID ::= '@prefix' PNAME_NS IRIREF '.'
base ::= '@base' IRIREF '.'
sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF
sparqlBase ::= "BASE" IRIREF
triples ::= (subject predicateObjectList) | (blankNodePropertyList predicateObjectList?)
predicateObjectList ::= verb objectList (';' (verb objectList)?)*
objectList ::= object annotation? (',' object annotation?)*
verb ::= predicate | 'a'
subject ::= iri | BlankNode | collection | quotedTriple
predicate ::= iri
object ::= iri | BlankNode | collection | blankNodePropertyList | literal | quotedTriple
literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
blankNodePropertyList ::= '[' predicateObjectList ']'
collection ::= '(' object* ')'
NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
RDFLiteral ::= String (LANGTAG | ('^^' iri))?
BooleanLiteral ::= 'true' | 'false'
String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
iri ::= IRIREF | PrefixedName
PrefixedName ::= PNAME_LN | PNAME_NS
BlankNode ::= BLANK_NODE_LABEL | ANON
quotedTriple ::= '<<' qtSubject predicate qtObject '>>'
qtSubject ::= iri | BlankNode | quotedTriple
qtObject ::= iri | BlankNode | literal | quotedTriple
annotation ::= '{|' predicateObjectList '|}'
@terminals # Productions for terminals
IRIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>'
PNAME_NS ::= PN_PREFIX? ':'
PNAME_LN ::= PNAME_NS PN_LOCAL
BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)?
LANGTAG ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*
INTEGER ::= [+-]? [0-9]+
DECIMAL ::= [+-]? ([0-9]* '.' [0-9]+)
DOUBLE ::= [+-]? (([0-9]+ '.' [0-9]* EXPONENT) | ('.' [0-9]+ EXPONENT) | ([0-9]+ EXPONENT))
EXPONENT ::= [eE] [+-]? [0-9]+
STRING_LITERAL_QUOTE ::= '"' ([^#x22#x5C#x0A#x0D] | ECHAR | UCHAR)* '"'
STRING_LITERAL_SINGLE_QUOTE ::= "'" ([^#x27#x5C#x0A#x0D] | ECHAR | UCHAR)* "'"
STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? ([^'\] | ECHAR | UCHAR))* "'''"
STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? ([^"\] | ECHAR | UCHAR))* '"""'
UCHAR ::= ('\u' HEX HEX HEX HEX) | ('\U' HEX HEX HEX HEX HEX HEX HEX HEX)
ECHAR ::= '\' [tbnrf\"']
NIL ::= '(' WS* ')'
WS ::= #x20 | #x09 | #x0D | #x0A
ANON ::= '[' WS* ']'
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]
PN_CHARS_U ::= PN_CHARS_BASE | '_'
PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
PLX ::= PERCENT | PN_LOCAL_ESC
PERCENT ::= '%' HEX HEX
HEX ::= [0-9] | [A-F] | [a-f]
PN_LOCAL_ESC ::= '\' ('_' | '~' | '.' | '-' | "!" | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%')