5 ms·
Hi, your homepage "unparsing" link goes to #evaluating, but the anchor on the docs page has id="eval" Also, how flexible is the unparsing? Does it have to be t
by hyperpallium 10y ago
Hi, your homepage "unparsing" link goes to #evaluating, but the anchor on the docs page has id="eval"
Also, how flexible is the unparsing? Does it have to be the same regular expression? [Sorry, I haven't read in detail and I'm only slightly familiar with ocaml - I'm interested from an academic perspective.]
- Drup 10y agoIf I understand your question correctly, no, it doesn't. Actually, the thing that you "unparse" doesn't even have to come from a regex matching to begin with. As long as the type matches, everything is fine. If you are interested by unparsing, I would advise you to read the (famous) paper functional unparsing by Danvy[1]. The module Printf and Format of the OCaml standard library are basically this paper on steroid. I recently wrote a blog on part of the implementation technique[2]. Hope that helps. :) [1]: http://www.brics.dk/RS/98/12/BRICS-RS-98-12.pdf http://www.brics.dk/RS/98/12/BRICS-RS-98-12.pdf [2]: https://drup.github.io/2016/08/02/difflists/ https://drup.github.io/2016/08/02/difflists/ [Printf]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.htm... [Format]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.html http://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.htm...
- hyperpallium 10y agoAh, thanks. I think one needs (structural) type transformation for the flexibility I had mind, things like swapping sum operands, re-ordering concantenation operands. Uh... did you see my bug report on your webpage (first sentence above)? That link still doesn't work properly.