The revised syntax

The revised syntax is an alternative syntax of OCaml. It is close to the normal syntax. We present here only the differences between the two syntaxes.

Notice that there is a simple way to know how the normal syntax is written in revised syntax: write the code in a file "foo.ml" in normal syntax and type, in a shell:

  camlp5o pr_r.cmo pr_rp.cmo foo.ml

And, conversely, how a file "bar.ml" written in revised syntax is displayed in normal syntax:

  camlp5r pr_o.cmo pr_op.cmo bar.ml

Even simpler, without creating a file:

  camlp5o pr_r.cmo pr_op.cmo -impl -
  ... type in normal syntax ...
  ... type control-D ...
  camlp5r pr_o.cmo pr_rp.cmo -impl -
  ... type in revised syntax ...
  ... type control-D ...
  1. Lexing
  2. Modules, Structure and Signature items
  3. Expressions and Patterns
  4. Types and Constructors
  5. Streams and Parsers
  6. Classes and Objects
  7. Labels and Variants

Lexing

Modules, Structure and Signature items

Expressions and Patterns

Imperative constructions

./usr/share/doc/camlp5/html/revsynt.html0000644000000000000000000007547011015210712017121 0ustar rootroot revised syntax

The revised syntax

The revised syntax is an alternative syntax of OCaml. It is close to the normal syntax. We present here only the differences between the two syntaxes.

Notice that there is a simple way to know how the normal syntax is written in revised syntax: write the code in a file "foo.ml" in normal syntax and type, in a shell:

  camlp5o pr_r.cmo pr_rp.cmo foo.ml

And, conversely, how a file "bar.ml" written in revised syntax is displayed in normal syntax:

  camlp5r pr_o.cmo pr_op.cmo bar.ml

Even simpler, without creating a file:

  camlp5o pr_r.cmo pr_op.cmo -impl -
  ... type in normal syntax ...
  ... type control-D ...
  camlp5r pr_o.cmo pr_rp.cmo -impl -
  ... type in revised syntax ...
  ... type control-D ...
  1. Lexing
  2. Modules, Structure and Signature items
  3. Expressions and Patterns
  4. Types and Constructors
  5. Streams and Parsers
  6. Classes and Objects
  7. Labels and Variants

Lexing

Modules, Structure and Signature items

Expressions and Patterns

Imperative constructions