Emacs Turns 50
Emacs debuted at MIT in 1976, bringing programmers a full-screen text editor that remains widely used today. Its roots in TECO and a culture of sharing helped shape the free software movement and GNU/Linux. (technologyreview.com)
A programmer building a C-expression parser revisits Pratt parsing to understand and remember how it works, relating it to the shunting-yard algorithm. Shunting yard uses an explicit operator stack and binding powers: tighter-binding operators stay on the stack, while operators of equal or lower precedence are emitted first. This simple approach handles basic arithmetic, but adding parentheses, unary operators, right-associative operators, or variable-argument functions requires special cases that can become awkward.
Pratt parsing makes the operator stack implicit in recursive calls. The parser first handles a token that can begin an expression, such as a number or a prefix operator; Pratt called these handlers “nud” functions. It then processes following infix or postfix operators, called “led” functions, according to binding power. Each operator triggers a recursive parse of its subexpression, and parsing returns when the next operator binds less tightly - functionally like unwinding the shunting-yard stack. The author demonstrates this with a small parser that emits postfix output, then adds parentheses by parsing their contents as a nested expression and checking for the closing delimiter. The key benefit is extensibility: operators can have their own parsing behavior while the central parser remains compact. A table combining binding power with prefix and infix/postfix handlers provides a practical structure for a more realistic parser, including unary and postfix operators.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.
Emacs debuted at MIT in 1976, bringing programmers a full-screen text editor that remains widely used today. Its roots in TECO and a culture of sharing helped shape the free software movement and GNU/Linux. (technologyreview.com)
C++ lookup tables can be optimized for extremely high query throughput, with the title claiming a billion queries per second. The topic is techniques for building fast lookup tables. (lemire.me)
Moxnox 1.0 is an NT-like, POSIX-compatible operating system that runs atop Btrfs. Its source code is available on GitHub. (github.com)
china-policy-data provides a free daily JSON feed of Shanghai government grant and subsidy notices. The feed is designed for researchers and AI agents. (github.com)
Linux 7.4 adds opt-in DMA-BUF read and write support through io_uring, enabling hardware memory buffers to move through the I/O path without CPU copies. The initial implementation supports NVMe block devices, with buffers up to 4 GB. (phoronix.com)
After a year running Dioxus fullstack apps, one Rust codebase and shared types across server and client make development and refactoring simpler. The major drawback is a 90-minute release build on GitHub Actions, and an all-Rust stack still has some exceptions. (oxidt.com)
Today's best Hacker News stories, summarized and screenshotted, one email a day.