4 ms·
S expressions are one of the most used serialization formats in OCaml. You can get pretty far relying on the standard parsers and printers. It's what I would do
by philzook 6y ago
S expressions are one of the most used serialization formats in OCaml. You can get pretty far relying on the standard parsers and printers. It's what I would do for a lisp in OCaml. Maybe you wanted to DIY as a learning thing? There are other options for parsing including parser combinators or using Menhir/ocamllex which are interesting in their own right.
https://dev.realworldocaml.org/data-serialization.html https://dev.realworldocaml.org/data-serialization.html
https://dev.realworldocaml.org/parsing-with-ocamllex-and-menhir.html https://dev.realworldocaml.org/parsing-with-ocamllex-and-men...
- djur 6y agoThis isn't really a good answer for someone who wants a regex engine. People use regexes for a lot of things where a full-fledged parser would be overkill, and I'm not sure what serialization has to do with anything.