[wg-camlp4] Changes to the Parsetree

Alain Frisch alain.frisch at lexifi.com
Wed Apr 17 13:56:04 BST 2013


Dear all,

Here is a list of the most important recent changes I've applied to the 
Parsetree in the extension_points branch.  The primary goals are to 
reduce the number of implicit invariants (not represented in the data 
structure itself) and make the Parsetree more user-friendly.

  - Splitting Pexp_constraint into two constructors, one to represent 
type constraints (e : t), another one to represent type coercion (e : t1 
:> t2) or (e :> t).

  - Splitting Pexp_function into two constructors, one for "function P1 
-> E1 | ... | Pn -> En", another for "fun P -> E / fun ~l:P -> E / fun 
?l:P -> E / fun ?l:(P = E) -> E".  (And removing support for "fun P when 
E -> E".)

  - Merging Pexp_assertfalse into Pexp_assert.

  - Keeping an explicit representation of interval patterns.

  - Explicit representation of "when" guards for function/match/try in a 
new "case" record type {pc_lhs: pattern; pc_guard: expression option; 
pc_rhs: expression}, instead of Pexp_when.

  - And a few more, listed in extension_points.txt.


Don't hesitate to comment on those changes, or to suggest other ones.

Also, the Parsetree module now documents all constructions and tries to 
list required invariants.


Alain


More information about the wg-camlp4 mailing list