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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Implement a programming language in 7 lines

59 点作者 frankpinto超过 9 年前

3 条评论

nickpsecurity超过 9 年前
This one is a cheat because read does a lot of the work. I can tolerate treating STDIN&#x2F;OUT as black boxes because they often are. The Scheme interpreter&#x27;s functionality is what&#x27;s custom. The read function is crucial to it. So, it&#x27;s implementation should be included. That puts this way over 7 lines.<p>The good news is that I now know where the name Y Combinator comes from. I imagine it will take me a lot longer to wrap my head around that concept, though. Truly weird haha.
评论 #10194135 未加载
评论 #10194871 未加载
评论 #10194733 未加载
segmondy超过 9 年前
Implementing a programming language in a few lines has always been done.<p>Here is an example in prolog of such a meta interpreter.<p><pre><code> interpret(true):- !. interpret(GoalA, GoalB):- !,interpret(GoalA),interpret(GoalB). interpret(Goal):- clause(Goal, Body), interpret(Body).</code></pre>
drallison超过 9 年前
Worth the read. Matt Might does really interesting things and explains what he does well. His blog is worth checking out.