funcexpr: /* This is a function: arguments -> string list */
LPAREN HEAD arguments RPAREN { let head a = [List.hd (List.hd a)] in head << $3 }
| LPAREN REAR arguments RPAREN { let rear b = List.tl (List.hd b) in rear << $3 }
| LPAREN ERECT arguments RPAREN { let erect c = List.append (List.hd c) (List.hd (List.tl c)) in erect << $3 }
;
arguments: /* This is a list of functions */
PARAM { let func p = p in func }
| funcexpr { [$1] }
| arguments arguments { List.append $1 $2 }
返回错误:错误:此表达式的类型为字符串列表 -> 字符串列表,但表达式应为字符串列表 -> 字符串列表列表类型字符串与字符串列表类型不兼容
我认为我们需要以某种方式将 func 放入列表中,但是我尝试过的每种方法似乎都不起作用!任何帮助表示赞赏..