Lexluthor Github Best Review

$lexer->rule('/\d+/', function(Token $token) echo "Number: $token->getValue()\n"; );

🔗 GitHub repo: https://github.com/lexluthor/luthor | Feature | Description | |---------|-------------| | Rule-based | Define token patterns using regular expressions | | PHP-native | Written in pure PHP, no extra extensions | | Streaming support | Process input character by character (memory efficient) | | Callback actions | Attach PHP callbacks to token rules | | Context switching | Supports lexer states (e.g., inside strings/comments) | Basic Usage Example use LexLuthor\Lexer; use LexLuthor\Token; $lexer = new Lexer(); 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-&gt