--- a/rdf-turtle/turtle.bnf Fri Jun 10 22:16:04 2011 -0700
+++ b/rdf-turtle/turtle.bnf Fri Jun 10 22:28:27 2011 -0700
@@ -1,64 +1,63 @@
-[1] Query ::= Prologue ConstructQuery
-[2] Prologue ::= BaseDecl? PrefixDecl*
-[3] BaseDecl ::= BASE IRI_REF '.'
-[4] PrefixDecl ::= PREFIX PNAME_NS IRI_REF '.'
-[6] ConstructQuery ::= ConstructTemplate
-[30] ConstructTemplate ::= ConstructTriples?
-[31] ConstructTriples ::= TriplesSameSubject ( '.' ConstructTriples? )?
-[32] TriplesSameSubject ::= GraphTerm PropertyListNotEmpty | TriplesNode PropertyList
-[33] PropertyListNotEmpty ::= Verb ObjectList ( ';' ( Verb ObjectList )? )*
-[34] PropertyList ::= PropertyListNotEmpty?
-[35] ObjectList ::= Object ( ',' Object )*
-[36] Object ::= GraphNode
-[37] Verb ::= IRIref | 'a'
-[38] TriplesNode ::= Collection | BlankNodePropertyList
-[39] BlankNodePropertyList ::= '[' PropertyListNotEmpty ']'
-[40] Collection ::= '(' GraphNode+ ')'
-[41] GraphNode ::= GraphTerm | TriplesNode
-[45] GraphTerm ::= IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL
-[60] RDFLiteral ::= String ( LANGTAG | ( '^^' IRIref ) )?
-[61] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative
-[62] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE
-[63] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE
-[64] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE
-[65] BooleanLiteral ::= 'true' | 'false'
-[66] String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2
-[67] IRIref ::= IRI_REF | PrefixedName
-[68] PrefixedName ::= PNAME_LN | PNAME_NS
-[69] BlankNode ::= BLANK_NODE_LABEL | ANON
+[1] turtleDoc ::= statement*
+[2] statement ::= directive '.' | triples '.'
+[3] directive ::= prefixID | base
+[4] prefixID ::= PREFIX PNAME_NS IRI_REF
+[5] base ::= BASE IRI_REF
+[6] triples ::= subject predicateObjectList
+[7] predicateObjectList ::= verb objectList ( ';' verb objectList )* ( ';')?
+[8] objectList ::= object ( ',' object)*
+[9] verb ::= predicate | 'a'
+[11] subject ::= IRIref | blank
+[12] predicate ::= IRIref
+[13] object ::= IRIref | blank | literal
+[14] literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
+[21] blank ::= BlankNode | '[' predicateObjectList ']' | collection
+[23] collection ::= '(' object* ')'
+[60s] RDFLiteral ::= String ( LANGTAG | ( '^^' IRIref ) )?
+[61s] NumericLiteral ::= NumericLiteralUnsigned | NumericLiteralPositive | NumericLiteralNegative
+[62s] NumericLiteralUnsigned ::= INTEGER | DECIMAL | DOUBLE
+[63s] NumericLiteralPositive ::= INTEGER_POSITIVE | DECIMAL_POSITIVE | DOUBLE_POSITIVE
+[64s] NumericLiteralNegative ::= INTEGER_NEGATIVE | DECIMAL_NEGATIVE | DOUBLE_NEGATIVE
+[65s] BooleanLiteral ::= 'true' | 'false'
+[66s] String ::= STRING_LITERAL1 | STRING_LITERAL2 | STRING_LITERAL_LONG1 | STRING_LITERAL_LONG2
+[67s] IRIref ::= IRI_REF | PrefixedName
+[68s] PrefixedName ::= PNAME_LN | PNAME_NS
+[69s] BlankNode ::= BLANK_NODE_LABEL | ANON
@terminals
-
-[70] IRI_REF ::= '<' ([^<>\"{}|^`\\]-[#x00-#x20])* '>'
-[71] PNAME_NS ::= PN_PREFIX? ':'
-[72] PNAME_LN ::= PNAME_NS PN_LOCAL
-[73] BLANK_NODE_LABEL ::= '_:' PN_LOCAL
-[74] BASE ::= '@base'
-[75] PREFIX ::= '@prefix'
-[76] LANGTAG ::= BASE | PREFIX | '@999' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*
-[77] INTEGER ::= [0-9]+
-[78] DECIMAL ::= [0-9]* '.' [0-9]+
-[79] DOUBLE ::= [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT
-[80] INTEGER_POSITIVE ::= '+' INTEGER
-[81] DECIMAL_POSITIVE ::= '+' DECIMAL
-[82] DOUBLE_POSITIVE ::= '+' DOUBLE
-[83] INTEGER_NEGATIVE ::= '-' INTEGER
-[84] DECIMAL_NEGATIVE ::= '-' DECIMAL
-[85] DOUBLE_NEGATIVE ::= '-' DOUBLE
-[86] EXPONENT ::= [eE] [+-]? [0-9]+
-[87] STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'"
-[88] STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"'
-[89] STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\\] | ECHAR ) )* "'''"
-[90] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\\] | ECHAR ) )* '"""'
-[91] ECHAR ::= '\\' [tbnrf\\"']
-[92] NIL ::= '(' WS* ')'
-[93] WS ::= #x20 | #x9 | #xD | #xA
-[94] ANON ::= '[' WS* ']'
-[95] PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
-[96] PN_CHARS_U ::= PN_CHARS_BASE | '_'
-[98] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]
-[99] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)?
-[100] PN_LOCAL ::= ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?
+[0] BASE ::= '@base'
+[0] PREFIX ::= '@prefix'
+[70s] IRI_REF ::= '<' ([^<>\"{}|^`\\]-[#x00-#x20])* '>'
+[71s] PNAME_NS ::= PN_PREFIX? ':'
+[72s] PNAME_LN ::= PNAME_NS PN_LOCAL
+[73s] BLANK_NODE_LABEL ::= '_:' PN_LOCAL
+[74s] VAR1 ::= '?' VARNAME
+[75s] VAR2 ::= '$' VARNAME
+[76s] LANGTAG ::= BASE | PREFIX | '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*
+[77s] INTEGER ::= [0-9]+
+[78s] DECIMAL ::= [0-9]+ '.' [0-9]* | '.' [0-9]+
+[79s] DOUBLE ::= [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+ EXPONENT
+[80s] INTEGER_POSITIVE ::= '+' INTEGER
+[81s] DECIMAL_POSITIVE ::= '+' DECIMAL
+[82s] DOUBLE_POSITIVE ::= '+' DOUBLE
+[83s] INTEGER_NEGATIVE ::= '-' INTEGER
+[84s] DECIMAL_NEGATIVE ::= '-' DECIMAL
+[85s] DOUBLE_NEGATIVE ::= '-' DOUBLE
+[86s] EXPONENT ::= [eE] [+-]? [0-9]+
+[87s] STRING_LITERAL1 ::= "'" ( ([^#x27#x5C#xA#xD]) | ECHAR )* "'"
+[88s] STRING_LITERAL2 ::= '"' ( ([^#x22#x5C#xA#xD]) | ECHAR )* '"'
+[89s] STRING_LITERAL_LONG1 ::= "'''" ( ( "'" | "''" )? ( [^'\\] | ECHAR ) )* "'''"
+[90s] STRING_LITERAL_LONG2 ::= '"""' ( ( '"' | '""' )? ( [^"\\] | ECHAR ) )* '"""'
+[91s] ECHAR ::= '\\' [tbnrf\\"']
+[92s] NIL ::= '(' WS* ')'
+[93s] WS ::= #x20 | #x9 | #xD | #xA
+[94s] ANON ::= '[' WS* ']'
+[95s] PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
+[96s] PN_CHARS_U ::= PN_CHARS_BASE | '_'
+[97s] VARNAME ::= ( PN_CHARS_U | [0-9] ) ( PN_CHARS_U | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )*
+[98s] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]
+[99s] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)?
+[100s] PN_LOCAL ::= ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?
@pass: [ \t\r\n]+ | '#' [^\r\n]*