News for hackers. Stuff that matters.
Re:Reimplementing TeX's Algorithms: Looking Back at Thirty Y... by aidenn0 on Monday January 12, 2015 @07:21PM (#8877380)
Most languages will have some sort of way of letting you extend them; inasmuch as this will require a new way of lexing, this will add some coupling.

One example: shell aliases. The shell syntax in POSIX is defined in the standard lexer/parser divide (which is already a bit of a pain, as a significant of the parsing logic is needed to correctly tokenize command expansions). When you encounter an alias expansion (which since it has to happen in the command position, doesn't happen until parse time) you expand the alias, and then need to re-lex the results.

In practice, many mature compilers and interpreters use a recursive-descent parser rather than any of the LL/LR/LALR things I learned in school.

Common Lisp actually defines its syntax in terms of a recursive-descent algorithm, and that's a language that largely came out of academia.

There are no comments on this comment yet.