Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jun Furuse committed Dec 11, 2017
1 parent bc5b0ec commit 5359994
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ppx_2018.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,23 @@ a
```
## AST mapperでASTを変更する
上のOCamlで書く初めてのPPXの例では`Ast_mapper.default_mapper`という、
`Ast_mapper.mapper`型のデータを使いました。この`mapper`はOCamlのASTをASTに写す「関数」です。
「関数」とカギカッコなのは、実際は関数群になっているからです。
`parsing/ast_mapper.mli`を参照してください:
```ocaml
(** {1 A generic Parsetree mapper} *)

type mapper = {
attribute: mapper -> attribute -> attribute;
attributes: mapper -> attribute list -> attribute list;
case: mapper -> case -> case;
cases: mapper -> case list -> case list;
class_declaration: mapper -> class_declaration -> class_declaration;
class_description: mapper -> class_description -> class_description;
...
```
山のように関数メンバのあるレコードです。

0 comments on commit 5359994

Please sign in to comment.