[MLton] Parsing bug?
Matthew Fluet
fluet@cs.cornell.edu
Mon, 6 Dec 2004 12:01:23 -0500 (EST)
> > As far as I can see, the SML/NJ version gets it right. MLton doesn't.
> > Even more disturbingly, MLton seems sensitive to how the input file is fed.
> >
> > If you run './train < train.input' you will get no output.
> > If you run './train' and cut-and-paste in the input, you get:
> > "klj"
> > (5, 7)
> >
> > ... ie: it ignores the first line.
> >
> > Am I mistaken, or is this a bug?
>
> It is a bug in the implementation of TextIO.getInstream. For efficiency,
> MLton implements an "imperative" ImperativeIO. When realizing the
> StreamIO.instream (as needed by scanStream), we empty the imperative
> buffer into the StreamIO.instream, but we were forgetting to mark the
> instream as a "stream" instream rather than an "imperative" instream.
BTW, I did check in a fix to the CVS head.