Stream parsers, again

From: Frank A. Christoph (christo@nextsolution.co.jp)
Date: Tue Feb 01 2000 - 03:19:18 MET

  • Next message: Daniel de Rauglaudre: "Re: Stream parsers, again"

    Regarding my previous message, I just figured out that it is actually quite
    easy to get "midstream" counts. Define this:

    let count = parser bp [< >] -> bp

    and then you can insert it in critical places like the example I gave:

      parser [< e = p; i = count; e' = p' ? err i >] -> ...

    BTW, it is nice that the error expression is itself lazily evaluated. I
    think it is too restrictive that it needs to return a string rather than an
    arbitrary type, but fortunately you can just raise an exception from within
    the stream error exception itself:

      exception Err of int
      let err cnt = raise (Err cnt)

    --fac



    This archive was generated by hypermail 2b29 : Wed Feb 02 2000 - 16:11:25 MET