On Monday, September 17, 2018, at 4:11 PM EDT, Fabrice Leal wrote: > I wanted to parse a text file with a non trivial syntax ( > https://en.wikipedia.org/wiki/Portable_Game_Notation) and was wondering > what would be the best way to achieve this. The best option seems to be > maybe FFI with C or haskell ... would it be too crazy to do this with plain > urweb?
I experimented a bit with reimplementing Parsec (https://hackage.haskell.org/package/parsec) in Ur. The basic idea isn't too complex - you build a monad that hangs on to four continuations (one for each of {"parse succeeded", "parse failed"} x {"consumed input", "consumed no input"}), and it's pretty easy to implement all the combinators you want in terms of it. I implemented a few combinators before I realized I really only needed regexes, so I switched to that (https://git.benjamin.barenblat.name/urweb-regex/). Anyway, point is, a pure Ur implementation should work, and you should consider using my regex library for any regular-language bits. :) I haven't pushed to it in a few years, but it does still build and work. I actually have some pending changes to it that I'm hoping to push soon - I'm getting rid of the Boost dependency and making the Autoconf a bit more robust. Let me know if you're interested in those changes; I can try to hurry them up. _______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
