Lexluthor Github -
$lexer->rule('/\d+/', function(Token $token) echo "Number: $token->getValue()\n"; );
LexLuthor is a GitHub username (and associated project) belonging to a developer who has created LexLuthor/luthor – a lightweight, rule-based lexer generator for PHP. It’s designed to help you build custom tokenizers/lexers for domain-specific languages (DSLs), configuration files, or simple programming languages. lexluthor github
If you need a full-featured or production-ready lexer, consider alternatives. But for hacking together a quick tokenizer in PHP, LexLuthor gets the job done with zero bloat. function(Token $token) echo "Number: $token->
$lexer->rule('/\s+/', function(Token $token) // skip whitespace ); function(Token $token) // skip whitespace )