Cheminformatics

A Guide to Cheminformatics

SMILES Formal Grammar v1.1

SMILES Grammar in W3C EBNF Format
/* Converted from PEG Grammar by http://bottlecaps.de/convert/  */
SMILES   ::= Atom ( Chain | Branch )*
Chain    ::= ( Bond? ( Atom | RingClosure ) )+
Branch   ::= '(' Bond? SMILES+ ')'
Atom     ::= OrganicSymbol
           | AromaticSymbol
           | AtomSpec
           | WILDCARD
Bond     ::= '-'
           | '='
           | '#'
           | '$'
           | ':'
           | '/'
           | '\'
           | '.'
AtomSpec ::= '[' Isotope? ( 'se' | 'as' | AromaticSymbol | ElementSymbol | WILDCARD ) ChiralClass? HCount? Charge? Class? ']'
OrganicSymbol
         ::= 'B' 'r'?
           | 'C' 'l'?
           | 'N'
           | 'O'
           | 'P'
           | 'S'
           | 'F'
           | 'I'
AromaticSymbol
         ::= 'b'
           | 'c'
           | 'n'
           | 'o'
           | 'p'
           | 's'
WILDCARD ::= '*'

<?TOKENS?>

ElementSymbol
         ::= [A-Z] [a-z]?
RingClosure
         ::= '%' [1-9] [0-9]
           | [0-9]
ChiralClass
         ::= ( '@' ( '@' | 'TH' [1-2] | 'AL' [1-2] | 'SP' [1-3] | 'TB' ( '1' [0-9]? | '2' '0'? | [3-9] ) | 'OH' ( '1' [0-9]? | '2' [0-9]? | '3' '0'? | [4-9] ) )? )?
Charge   ::= '-' ( '-' | '0' | '1' [0-5]? | [2-9] )?
           | '+' ( '+' | '0' | '1' [0-5]? | [2-9] )?
HCount   ::= 'H' [0-9]?
Class    ::= ':' [0-9]+
Isotope  ::= [1-9] [0-9]? [0-9]?

This grammar is based on the Open Smiles Specification and other written documentation.

Resources