TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: A Regex-to-Golang compiler based on Thompson's algorithm

1 点作者 akiarie将近 3 年前

1 comment

akiarie将近 3 年前
Ken Thompson&#x27;s famous paper on implementing regular expressions is surprisingly simple and yet extremely sophisticated at the same time. The &quot;heart&quot; of the method he proposed was the use of a stack in order to compile the expression to code that parses it, which in this case was IBM 7094 object code.<p>I find this idea beautiful, and wanted a chance to play around with it for myself, as well as demonstrate to anyone interested the way the algorithm works. Since the aim is demonstration rather than a concrete (or usable) implementation, it makes sense to compile to a high-level language, which is why I have started by targeting Go.<p>All suggestions are welcome!