[wg-camlp4] Changes to the parsetree
Leo White
lpw25 at cam.ac.uk
Wed Apr 10 20:21:31 BST 2013
> I think we should keep the Parsetree type as close as possible (at reasonable costs) to the set of ASTs that can be
> produced by the parser. This will reduce the risk of generating Parsetree fragments which cannot be pretty-printed (as
> source code) faithfully.
In general I agree with this, however there are always going to be
places where the Parsetree accepts more values than the parser.
> So, if we want to move from "string loc list" to "core_type list" (which will give attributes for free on parameters),
> we should accept arbitrary types in the parser and fail in the type-checker. (There is no real drawback for the
> end-user.) The problem is that this introduces conflicts in the grammar. The simpler way I've found to address them
> without changing the parser too much is to add the variance prefixes (+ and -) as new constructors in core_type (with
> corresponding grammar rules), but this is not very nice.
Adding variance constructors to core_type seems like it will create more
problems than it solves. I think it would be simpler to have type
parameters only accept Ptyp_any, Ptyp_var and Ptyp_extension.
More information about the wg-camlp4
mailing list