constant.bnf 812 Bytes
Newer Older
1
\begin{syntax}
2
  digit ::= "0" - "9"
3
  \
4
  hex-digit ::= "0" - "9" | "a" - "f" | "A" - "F"
5
  \
6
  oct-digit ::= "0" - "7"
7
  \
8
  bin-digit ::= "0" | "1"
9
  \
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
  integer ::= digit (digit | "_")*               ;
    | ("0x" | "0X") hex-digit (hex-digit | "_")* ;
    | ("0o" | "0O") oct-digit (oct-digit | "_")* ;
    | ("0b" | "0B") bin-digit (bin-digit | "_")* ;
  \
  real ::= digit+ exponent                      ;
    | digit+ "." digit* exponent?               ;
    | digit* "." digit+ exponent?               ;
    | ("0x" | "0X") hex-digit+ h-exponent                 ;
    | ("0x" | "0X") hex-digit+ "." hex-digit* h-exponent? ;
    | ("0x" | "0X") hex-digit* "." hex-digit+ h-exponent? ;
  \
  exponent ::= ("e" | "E") ("-" | "+")? digit+
  \
  h-exponent ::= ("p" | "P") ("-" | "+")? digit+ %
\end{syntax}