1 | |
---|

2 | (** This module provides folding functions over the constructors of the |
---|

3 | [Cminor]'s AST. *) |
---|

4 | |
---|

5 | (* In [expression_left f e], [f]'s second argument is the list of |
---|

6 | [expression_left]'s results on [e]'s sub-expressions. The results are |
---|

7 | computed from left to right following their appearance order in the |
---|

8 | [Cminor.expression] type. *) |
---|

9 | |
---|

10 | val expression_left : (Cminor.expression -> 'a list -> 'a) -> |
---|

11 | Cminor.expression -> |
---|

12 | 'a |
---|

13 | |
---|

14 | (* In [statement_left f_expr f_stmt stmt], [f_stmt]'s second argument is the |
---|

15 | list of [expression_left f_expr]'s results on [stmt]'s sub-expressions, and |
---|

16 | [f_stmt]'s third argument is the list of [statement_left]'s results |
---|

17 | on [stmt]'s sub-statements. The results are computed from left to right |
---|

18 | following their appearance order in the [Cminor.statement] type. *) |
---|

19 | |
---|

20 | val statement_left : (Cminor.expression -> 'a list -> 'a) -> |
---|

21 | (Cminor.statement -> 'a list -> 'b list -> 'b) -> |
---|

22 | Cminor.statement -> |
---|

23 | 'b |
---|

24 | |
---|

25 | |
---|

26 | (* In [expression_right f e], [f]'s second argument is the list of |
---|

27 | [expression_right]'s results on [e]'s sub-expressions. The results are |
---|

28 | computed from right to left following their appearance order in the |
---|

29 | [Cminor.expression] type. *) |
---|

30 | |
---|

31 | val expression_right : ('a list -> Cminor.expression -> 'a) -> |
---|

32 | Cminor.expression -> |
---|

33 | 'a |
---|

34 | |
---|

35 | (* In [statement_right f_expr f_stmt stmt], [f_stmt]'s second argument is the |
---|

36 | list of [expression_left f_expr]'s results on [stmt]'s sub-expressions, and |
---|

37 | [f_stmt]'s third argument is the list of [statement_left]'s results |
---|

38 | on [stmt]'s sub-statements. The results are computed from right to left |
---|

39 | following their appearance order in the [Cminor.statement] type. *) |
---|

40 | |
---|

41 | val statement_right : ('a list -> Cminor.expression -> 'a) -> |
---|

42 | ('a list -> 'b list -> Cminor.statement -> 'b) -> |
---|

43 | Cminor.statement -> |
---|

44 | 'b |
---|