Just wanted to mention that I have used ragel to validate SPF (www.openspf.org) in my RaSPF (http://code.google.com/p/ragel) and it's really a great tool!