Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added note on basic RE implementation I started a while back


  • Someone started a binary parser and pickler combinator library.  Still looks immature, but might provide some good ideas.

  • I started a Scala implementation of a regular expression language specific to XML Schema last year.  It uses the automaton classes in scala.util.automata.  It's a really basic implementation, but I'd be happy to contribute it.  The automata classes in particular are not specific to characters, so they could be adapted to match binary data instead.  --Jonathan Cranford

Miscellaneous notes:

java scanner - takes Readable as input (good), doesn't allow regex that matches at beginning of stream.

Implement longest match by rotating through mulitiple regex matchers, which determine if the pattern matches immediately at the beginning of the supplied characters.

Java regex Matcher class takes only CharSequence as input.

CharSequence is finite (has length() method) which precludes (most likely) creating a virtualized stream-like behavior underneath our own CharSequence implementation.


Scala ||| combinator of regex parsers produces longest match to the combined regex's.

Scala combinator parsers read from a Reader.

The reader can virtualize the character stream up until a decode error, or size limit of our choice, and can hide all details of when additional blocks of data must be retrieved.

val rdr = new InputStreamReader(Channels.newInputStream(rbc : ReadableByteChannel)

// Must figure out what happens if character decoding gets an error.
// Worst case, we have to implement Reader interface ourselves with code that calls the decoder.

// length limit on delimiter match could be implemented by creating a finites substream from the rbc, instead of just handing the original rbc to it.

val pr = Parser.parse(rdr)