P. S.
Today, I am trying to adopt something similar to my file compressor and
searching for info. AFAIK, such Optimal Parser before making a choice
looks not only for a few steps ahead, but also calculates the literal
and match price - i.e. the actual number of bits needed to encode the
literal and a match.
-- Ilia Muraviev
Exactly. A good writeup on one solution is Pasi's pucrunch pages:
http://www.cs.tut.fi/~albert/Dev/pucrunch/#Graph is a good place to
start reading.