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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

A tiny interpreter for a stack-based language

29 点作者 JGM564超过 16 年前

4 条评论

Locke超过 16 年前
Stack-based languages can be fun to play around with.<p>Way back when, I used Quartus Forth (<a href="http://www.quartus.net/products/forth/" rel="nofollow">http://www.quartus.net/products/forth/</a>) to write a few small games for my Palm. Quartus is (was? looks dead...) an onboard Forth compiler -- Forth is a very compact language which is handy when you're writing code with a stylus.<p>The thing I remember most about it was that the actual coding was probably more fun than that playing the games I wrote. There's a kind of puzzle solving element to learning a stack-based language. I already knew how I'd write such-and-such function in a C-like language, it was all about arranging words in the most succinct, efficient manner possible to create the equivalent function.<p>I don't think I'd go back to Forth or another stack-based language for a project these days, but I'm glad for the time I spent playing with it.
nostrademons超过 16 年前
The best thing about stack-based languages are that the parsers are usually dead simple. I did one in Haskell, never released, and the parser consisted of one standard-library function call: words.
brianobush超过 16 年前
his anonymous blocks ( 1 + ) look straight from false, <a href="http://wouter.fov120.com/false/" rel="nofollow">http://wouter.fov120.com/false/</a> with different syntax, but the same idea: 2 [ 1 + ] ! leaves 3 as top of stack.
评论 #406324 未加载
gsmaverick超过 16 年前
Nice tutorial thanks!