[wg-camlp4] Pending issues

Leo White lpw25 at cam.ac.uk
Wed Feb 13 17:56:36 GMT 2013


>What I was thinking of whas that a ppx rewriter could get whatever
>expression as attributes, but what remains after applying all rewriters
>must be included in a subset that could map to a type like (maybe a bit
>too restricitve)
>
>type expr =
>  | List of expr list
>  | Sum of string * expr
>  | Cst of string
>

This interface can be provided by:

------
  (* Ast.mli *)

  type expr

  type simple_expr = 
  | List of expr list
  | Sum of string * simple_expr
  | Cst of string

  val simplify_expr: expr -> simple_expr

------
  (* Ast.ml *)

  type expr = Parsetree.expression

  type simple_expr =
  | List of expr list
  | Sum of string * simple_expr
  | Cst of string

  let simplify_expr expr = ...

------
  (* Parsetree.mli *)

  type expression = ...

  val of_ast_expr: Ast.expr -> expression

------
  (* Parsetree.ml *)

  type expression = ...

  external of_ast_expr: Ast.expr -> expression = "%identity"

------

This would allow users to use the fixed simple interface, or the full 
parsetree interface.



More information about the wg-camlp4 mailing list