Lex solves a restricted subset of state machine code generation problems; Ragel aims to solve all state machine code generation problems generally. You can do anything you can do in Lex in Ragel. The reverse is not true. Lex is simpler, but less powerful than Ragel. It&#x27;s sort of like awk versus Perl.<p>I&#x27;d rather use Lex where Lex is good enough.