Search code examples
parsingf#lexical-analysisfparsec

Use FParsec on already tokenized UInt16 stream


I need to parse an already tokenized stream of type UInt16 seq.
How can I do this with FParsec?
All the top level functions I can find in the reference work on charstreams.

At the moment I convert the UInt16s to chars which seems silly.


Solution

  • Unfortunately it is not possible to use FParsec on anything else than a CharStream.

    I solved the problem by writing a simple parser combinator myself, using this article.
    Surprisingly this was only one day's worth of work.
    I learned a lot about parser combinators in the process.