Hi,
I’m very new to ocaml. I’m working in a parser with menhir and got the following compiler error. Which I have no clue how to solve:
The function output_value gets the parsed abstract syntax tree and pretty prints it. I just tried to print Kind in the same fashion of
List but the compiler throws the error below.
let rec output_value outc = function
| List l -> print_list outc l |
String s -> printf “”%s"" s
| Int i -> printf "INT %d" i |
Null -> printf “NULL”
| Kind k -> print_kind k |
Ident id -> printf “IDENT %s” id
ocamlbuild -use-menhir -tag thread -use-ocamlfind -quiet -pkg core metanetics.native
- ocamlfind ocamlc -c -thread -package core -o nds.cmo nds.ml
File “nds.ml”, line 20, characters 17-29:
Error: This expression has type 'a * 'b * 'c * 'd
but an expression was expected of type unit
Command exited with code 2.
The code is available at https://github.com/joaoepj/metanetics/commit/a812ad9f8c819a79da88098879dfb096fa367cbe