8.17 Extension-only syntax

Some syntactic constructions are accepted during parsing and rejectedduring type checking. These syntactic constructions can therefore notbe used directly in vanilla OCaml. However, -ppx rewriters and otherexternal tools can exploit this parser leniency to extend the languagewith these new syntactic constructions by rewriting them tovanilla constructions.

8.17.1 Extension operators

(Introduced in OCaml 4.02.2)

infix-symbol::=
# {operator-chars} # {operator-char | #}

Operator names starting with a # character and containing more thanone # character are reserved for extensions.

8.17.2 Extension literals

(Introduced in OCaml 4.03)

float-literal::=
[-] (0…9) { 0…9∣ } [. { 0…9∣ }][(e∣ E) [+∣ -] (0…9) { 0…9∣ }][g…z∣ G…Z]
[-] (0x∣ 0X)(0…9∣ A…F∣ a…f){ 0…9∣ A…F∣ a…f∣ }[. { 0…9∣ A…F∣ a…f∣ }][(p∣ P) [+∣ -] (0…9) { 0…9∣ }][g…z∣ G…Z]
int-literal::=
[-] (0…9) { 0…9 ∣ }[g…z∣ G…Z]
[-] (0x∣ 0X) (0…9∣ A…F∣ a…f){ 0…9∣ A…F∣ a…f∣ }[g…z∣ G…Z]
[-] (0o∣ 0O) (0…7) { 0…7∣ }[g…z∣ G…Z]
[-] (0b∣ 0B) (0…1) { 0…1∣ }[g…z∣ G…Z]

Int and float literals followed by an one-letter identifier in therange [g..z∣ G..Z] are extension-only literals.