I have seen some source code having
let rec parse_document = parser
| [< len = parse_int32; st; >] ->
parse_list [] (ES.take_int32 len st)
| [< >] -> malformed "parse_document"
Can I know what is [< >]
inside? it is too hard to google about this kind of signs.
This is a syntactic sugar for the Stream datatype. Its manipulation is described in detail in this chapter of the book Developping Applications with OCaml.
The syntactic sugar is not built-in in the compiler, it needs to be preprocessed by the Camlp4 preprocessor. To do that, you have to add -pp camlp4o
to your compilation command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With