In the extended BNF expression below white space is explicitly denoted <WS>. Literals are quoted as in 'literal', while \' indicates apostrophe character.

Basic non-terminals used:

 <Name> ::= <Letter> { <NameEnd> }
 <NameEnd> ::= ( <Letter> | <Digit> | '_' ) { <NameEnd> }
 <Letter> ::= 'a' | 'b' | ... | 'z' | 'A' | 'B' | ... | 'Z'
 <Digit> ::= '0' | '1' | ... | '9'
 <Value> ::= <Integer> | <Real> | <Time> | \'<String>\'
 <Time> ::= See SOI TN 94-116
 <Value_Increment> ::= <Integer> | <Real> | <Time_Increment>
 <Time_Increment> ::= <Real><Time_Increment_Specifier>
 <Time_Increment_Specifier> ::= 's' | 'm' | 'h' | 'd'

Main rules:

 <RecordSet>  ::= <SeriesName> <RecordSet_Filter> 
 <SeriesName> ::= <Name>

 <RecordSet_Filter> ::= '[' ( <RecordQuery> | <RecordList> ) ']' 
                         { <RecordSet_Filter> }

 <RecordQuery> ::= '?' <SQL where clause> '?'

 <RecordList> ::= ( ':'<RecnumRangeSet> | 
                    {<Primekey_Name>'='}<PrimekeyRangeSet> )
 <RecnumRangeSet> ::= <IndexRangeSet>
 <Primekey_Name> :: <Name>

 <PrimekeyRangeSet> ::= ( <IndexRangeSet> | <ValueRangeSet> )

 <IndexRangeSet> ::= ( '#' '^' |
                       '#' '$' |
                       '#' <Integer> |
                       '#' <Integer> '-' '#' { '@' <Integer> } |
                       '#' '-' '#' <Integer> { '@' <Integer> } |
                       '#' <Integer> '-' '#' <Integer> { '@' <Integer> } |
                       '#' <Integer> '/' <Integer> { '@' <Integer> } 
                      ) { ',' <IndexRangeSet> }

 <ValueRangeSet> ::= ( <Value> |
                       <Value> '-' <Value> { '@' <Value_Increment> } |
                       <Value> '/' <Value_Increment> { '@' <Value_Increment> } 
                      ) { ',' <ValueRangeSet> }

Some notes on usage:

seriesname[][2006.01.04/4d]