This is Plex, a lexical analysis module for Python.



Plex-1.1.5.tar.gz (60350 bytes; last updated 27 January 2007)

Version History


Removed spurious newline from the end of test12's input file, which was causing the test to fail.


Fixed bug causing argument of Rep or Rep1 to fail to match following a newline.


 Fixed bug causing Eol to fail to match at the beginning of a line in some circumstances.


  1. Renamed Scanner.yield() to Scanner.produce() to accommodate Python 2.3, where yield is a keyword.
  2. Changed test10 to not rely so much on details of string repr.


  1. Added import of types to
  2. Uncommented the non-inlined version of Scanner.next_char()


  1. Case() and NoCase() constructors for controlling case-sensitivity of pattern matching.


  1. Range() constructor for patterns which match contiguous ranges of characters.
  2. Support for traditional regular expression syntax.
  3. Building a Lexicon is about 4 times faster.
  4. The assumption of 8-bit character codes has been removed. It should be Unicode-ready now.
  5. The scanner is unfortunately a whisker slower. Not quite sure why - seems to be a consequence of change (4). Sorry about that! Hope to do a C version soon, though.


  1. Documentation greatly expanded.
  2. Numerous examples and test cases added.
  3. NFA to DFA algorithm improved (i.e. it's correct now!)
Implementation is still currently in pure Python.  The scanner is about as fast as I can make it in Python.  The examples/ script will give you an idea of the performance on your machine. If enough people complain about the speed, I may rewrite the scanner in C, which should improve things considerably.

Greg Ewing
Computer Science Department
University of Canterbury
New Zealand