[wg-camlp4] Changes to the parsetree
Alain Frisch
alain.frisch at lexifi.com
Mon Mar 25 11:42:57 GMT 2013
Dear all,
Now that we have reached a stable state concerning the syntax of
attributes and extension nodes, I'd like to get feedback on the proposed
changes to the definition of the Parsetree:
http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/parsing/parsetree.mli?r1=13329&r2=HEAD
The following changes have been applied:
- Adding new constructors for extension nodes and for attributes as
stand-alone signature/structure items.
- Storing attributes as new fields in record types (such as
expression, pattern, core_type, etc).
- Introducing some more records to replace tuples/n-ary constructors:
label_declaration, constructor_declaration, exception_declaration,
module_declaration, module_type_declaration, module_binding,
module_type_binding.
- Adding a name field to value_description and type_declaration.
Another tiny change is that recursive modules are no longer restricted
syntactically to come with explicit module types (this is enforced in
the type-checker). This means that "module rec A = (struct ... end :
sig ... end)" is now accepted as well as "module rec A : sig ... end =
struct ... end".
More cleanup to the Parsetree representation can be considered. Examples:
- Cleaner representation of "when" guard (before doing anything here,
I'd like to know if the removal of the "fun pat when cond -> ..." form
will be accepted, see http://caml.inria.fr/mantis/view.php?id=5939).
- Doing less desugaring the parser (interval patterns, M.(e) === let
open M in e, ....).
- Make the type-checker more robust w.r.t. where Ptyp_poly node have
to be inserted (currently the parser introduces some empty Ptyp_poly
nodes and the type-checker expects to find them).
- Replacing Booleans with more explicit sum types and getting rid of
more tuples/n-ary constructors.
It's probably good to validate the general approach first with the core
team before we apply any such further cleanups. Before submitting the
current version for review to the core team, I'd like to get feedback
from the participants of this working group.
Alain
More information about the wg-camlp4
mailing list