TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Implement a programming language in 7 lines

59 pointsby frankpintoover 9 years ago

3 comments

nickpsecurityover 9 years ago
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 未加载
segmondyover 9 years ago
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>
drallisonover 9 years ago
Worth the read. Matt Might does really interesting things and explains what he does well. His blog is worth checking out.