A formal grammar for CIF in extended Backus-Naur form. This is a terse summary of the CIF grammar in an extended Backus-Naur form. An expanded listing with full description is found in the CIF syntax document. The full syntax document should be read for information about specifications that cannot be expressed in a context-free Backus-Naur form. The grammar is presented twice. Version (i) is a plain-text version of the tabular form displayed in the CIF syntax document, with indication of case sensitivity and laid out for convenient reading in a fixed-width typeface. Version (ii) is more compact and omits headings and information about case sensitivity. Productions use the symbol ::= to separate left and right sides. This version can be directly machine-parsed. ================================================================================ (i) Tabular form ================================================================================ Basic Structure of a CIF -------------------------------------------------------------------------------- syntactic unit syntax case sensitive? -------------------------------------------------------------------------------- ? ? { { yes }* { }? }? { { | } }* yes { }+ no { }+ yes { }+ no | yes { }+ no { }* yes Reserved Words -------------------------------------------------------------------------------- syntactic unit syntax case sensitive? -------------------------------------------------------------------------------- {'D' | 'd'} {'A' | 'a'} {'T' | 't'} {'A' | 'a'} '_' no {'L' | 'l'} {'O' | 'o'} {'O' | 'o'} {'P' | 'p'} '_' no {'G' | 'g'} {'L' | 'l'} {'O' | 'o'} {'B' | 'b'} no {'A' | 'a'} {'L' | 'l'} '_' {'S' | 's'} {'A' | 'a'} {'V' | 'v'} {'E' | 'e'} '_' no {'S' | 's'} {'T' | 't'} {'O' | 'o'} {'P' | 'p'} '_' no Tags and Values -------------------------------------------------------------------------------- syntactic unit syntax case sensitive? -------------------------------------------------------------------------------- '_'{ }+ no { '.' | '?' | | | } yes Numeric Values -------------------------------------------------------------------------------- syntactic unit syntax case sensitive? -------------------------------------------------------------------------------- { | '(' ')' } no { | } no { '+' | '-' }? no { | no { {'+'|'-'} ? { {} * '.' } | { } + '.' } } {} ? } } { {'e' | 'E' } | {'e' | 'E' } { '+' | '- ' } } no { }+ no { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | no '8' | '9' } Character Strings and Text Fields -------------------------------------------------------------------------------- syntactic unit syntax case sensitive? -------------------------------------------------------------------------------- | | yes {}* yes {|';'} {}* yes yes {}* yes {}* { } yes ';' { {}* yes {{ {}*}? }* } ';' WhiteSpace and Comments -------------------------------------------------------------------------------- syntactic unit syntax case sensitive? -------------------------------------------------------------------------------- { | | | }+ yes { '#' {}* }+ yes { | | |}+ yes Character Sets -------------------------------------------------------------------------------- syntactic unit syntax case sensitive? -------------------------------------------------------------------------------- { '!' | '%' | '&' | '(' | ')' | '*' | '+' | ',' | yes '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ':' | '<' | '=' | '>' | '?' | '@' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '\' | '^' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}' | '~' } | | '#' | '$' | yes | '_' |';' | '[' | ']' | | '#' | '$' | yes | '_' | | |'[' | ']' | | '#' | '$' | yes | '_' | | | ';' | '[' | ']' ================================================================================ (ii) Machine-parsable form ================================================================================ ::= ? ? { { }* { }? }? ::= { { | } }* ::= { }+ ::= { }+ ::= { }+ ::= | ::= { }+ ::= { }* ::= {'D' | 'd'} {'A' | 'a'} {'T' | 't'} {'A' | 'a'} '_' ::= {'L' | 'l'} {'O' | 'o'} {'O' | 'o'} {'P' | 'p'} '_' ::= {'G' | 'g'} {'L' | 'l'} {'O' | 'o'} {'B' | 'b'} {'A' | 'a'} {'L' | 'l'} '_' ::= {'S' | 's'} {'A' | 'a'} {'V' | 'v'} {'E' | 'e'} '_' ::= {'S' | 's'} {'T' | 't'} {'O' | 'o'} {'P' | 'p'} '_' ::= '_'{ }+ ::= { '.' | '?' | | | } ::= { | '(' ')' } ::= { | } ::= { '+' | '-' }? ::= { | { {'+'|'-'} ? { {} * '.' } | { } + '.' } } {} ? } } ::= { {'e' | 'E' } | {'e' | 'E' } { '+' | '- ' } } ::= { }+ ::= { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' } ::= | | ::= {}* ::= {|';'} {}* ::= {}* ::= {}* ::= { } ::= ';' { {}* {{ {}*}? }* } ';' ::= { | | | }+ ::= { '#' {}* }+ ::= { | | |}+ ::= { '!' | '%' | '&' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | ':' | '<' | '=' | '>' | '?' | '@' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '\' | '^' | '`' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | '{' | '|' | '}' | '~' } ::= | | '#' | '$' | | '_' |';' | '[' | ']' ::= | | '#' | '$' | | '_' | | |'[' | ']' ::= | | '#' | '$' | | '_' | | | ';' | '[' | ']' ================================================================================