2 ms·
Good advice, but every good rule requires context: sometimes a really simple grammar (e.g. a lisp tokenizer) is faster to implement with a tiny handmade recursi
by gumby 6y ago
Good advice, but every good rule requires context: sometimes a really simple grammar (e.g. a lisp tokenizer) is faster to implement with a tiny handmade recursive descent parser that could fit on a single page of code. Faster to write and easier to understand than calling out to a pen external lexer.
Not THAT being said I will contradict myself: when you are writing a tiny language like that it’s easy to accidentally add dependencies like context-sensitive behavior. Which means if things grow to the point where you need a parser generator it may become much harder.