Lexluthor Github __link__ Review

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.

🔗 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

$lexer->rule('/[a-z]+/', function(Token $token) echo "Word: $token->getValue()\n"; ); If you need a full-featured or production-ready lexer,

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. It’s designed to help you build custom tokenizers/lexers

$lexer->rule('/\s+/', function(Token $token) // skip whitespace );

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

blank