[1] turtleDoc ::= statement*
[2] statement ::= directive | (triples '.')
[3] directive ::= prefixID | base | sparqlPrefix | sparqlBase
[4] prefixID ::= '@prefix' PNAME_NS IRIREF '.'
[5] base ::= '@base' IRIREF '.'
[6] sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF
[7] sparqlBase ::= "BASE" IRIREF
[8] triples ::= (subject predicateObjectList) | (blankNodePropertyList predicateObjectList?) | (reifiedTriple predicateObjectList?)
[9] predicateObjectList ::= verb objectList (';' (verb objectList)?)*
[10] objectList ::= object annotation (',' object annotation)*
[11] verb ::= predicate | 'a'
[12] subject ::= iri | BlankNode | collection
[13] predicate ::= iri
[14] object ::= iri | BlankNode | collection | blankNodePropertyList | literal | tripleTerm | reifiedTriple
[15] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
[16] blankNodePropertyList ::= '[' predicateObjectList ']'
[17] collection ::= '(' object* ')'
[18] NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
[19] RDFLiteral ::= String (LANG_DIR | ('^^' iri))?
[20] BooleanLiteral ::= 'true' | 'false'
[21] String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
[22] iri ::= IRIREF | PrefixedName
[23] PrefixedName ::= PNAME_LN | PNAME_NS
[24] BlankNode ::= BLANK_NODE_LABEL | ANON
[25] reifier ::= '~' (iri | BlankNode)?
[26] reifiedTriple ::= '<<' rtSubject verb rtObject reifier? '>>'
[27] rtSubject ::= iri | BlankNode | reifiedTriple
[28] rtObject ::= iri | BlankNode | literal | tripleTerm | reifiedTriple
[29] tripleTerm ::= '<<(' ttSubject verb ttObject ')>>'
[30] ttSubject ::= iri | BlankNode
[31] ttObject ::= iri | BlankNode | literal | tripleTerm
[32] annotation ::= (reifier | annotationBlock)*
[33] annotationBlock ::= '{|' predicateObjectList '|}'

Productions for terminals

[35] IRIREF ::= '<' ([^#x00-#x20<>"{}|^`\] | UCHAR)* '>'
/* #x00=NULL #x01-#x1F=control codes #x20=space */
[36] PNAME_NS ::= PN_PREFIX? ':'
[37] PNAME_LN ::= PNAME_NS PN_LOCAL
[38] BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | [0-9]) ((PN_CHARS | '.')* PN_CHARS)?
[39] LANG_DIR ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)* ('--' [a-zA-Z]+)?
[40] INTEGER ::= [+-]? [0-9]+
[41] DECIMAL ::= [+-]? ([0-9]* '.' [0-9]+)
[42] DOUBLE ::= [+-]? (([0-9]+ '.' [0-9]* EXPONENT) | ('.' [0-9]+ EXPONENT) | ([0-9]+ EXPONENT))
[43] EXPONENT ::= [eE] [+-]? [0-9]+
[44] STRING_LITERAL_QUOTE ::= '"' ([^#x22#x5C#x0A#x0D] | ECHAR | UCHAR)* '"'
[45] STRING_LITERAL_SINGLE_QUOTE ::= "'" ([^#x27#x5C#x0A#x0D] | ECHAR | UCHAR)* "'"
[46] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? ([^'\] | ECHAR | UCHAR))* "'''"
[47] STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? ([^"\] | ECHAR | UCHAR))* '"""'
[48] UCHAR ::= ('\u' HEX HEX HEX HEX) | ('\U' HEX HEX HEX HEX HEX HEX HEX HEX)
[49] ECHAR ::= '\' [tbnrf\"']
[50] WS ::= #x20 | #x09 | #x0D | #x0A
[51] ANON ::= '[' WS* ']'
[52] 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]
[53] PN_CHARS_U ::= PN_CHARS_BASE | '_'
[54] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
[55] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
[56] PN_LOCAL ::= (PN_CHARS_U | ':' | [0-9] | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
[57] PLX ::= PERCENT | PN_LOCAL_ESC
[58] PERCENT ::= '%' HEX HEX
[59] HEX ::= [0-9] | [A-F] | [a-f]
[60] PN_LOCAL_ESC ::= '\' ('_' | '~' | '.' | '-' | "!" | '$' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%')