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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Top Down Operator Precedence (2007)

25 点作者 brodo超过 4 年前

2 条评论

munificent超过 4 年前
This is my favorite parsing technique, but I found Crockford&#x27;s presentation of it really difficult to wrap my head around. I think he muddles the technique with his own strong opinions around dynamic types and prototypes. In particular:<p><i>&gt; Another explanation is that his technique is most effective when used in a dynamic, functional programming language. Its use in a static, procedural language would be considerably more difficult.</i><p>I&#x27;ve implemented Pratt parsers in Java, C#, C++, Dart, and C, and I&#x27;ve never found them difficult to express in any of those languages. If you&#x27;d like a different treatment of the technique, I wrote a blog post about them using Java:<p><a href="http:&#x2F;&#x2F;journal.stuffwithstuff.com&#x2F;2011&#x2F;03&#x2F;19&#x2F;pratt-parsers-expression-parsing-made-easy&#x2F;" rel="nofollow">http:&#x2F;&#x2F;journal.stuffwithstuff.com&#x2F;2011&#x2F;03&#x2F;19&#x2F;pratt-parsers-e...</a><p>And a chapter in my book using C:<p><a href="http:&#x2F;&#x2F;craftinginterpreters.com&#x2F;compiling-expressions.html" rel="nofollow">http:&#x2F;&#x2F;craftinginterpreters.com&#x2F;compiling-expressions.html</a>
评论 #25449433 未加载
评论 #25449094 未加载
lioeters超过 4 年前
A fairly recent take on the technique, with an accompanying TypeScript implementation:<p>How Desmos uses Pratt Parsers - <a href="https:&#x2F;&#x2F;engineering.desmos.com&#x2F;articles&#x2F;pratt-parser&#x2F;" rel="nofollow">https:&#x2F;&#x2F;engineering.desmos.com&#x2F;articles&#x2F;pratt-parser&#x2F;</a> (Dec 2018)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;desmosinc&#x2F;pratt-parser-blog-code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;desmosinc&#x2F;pratt-parser-blog-code</a><p>At the bottom of the article, they mention a number of articles including the posted one by Doug Crockford, as well as the (excellent) article mentioned in a sibling comment, by @munificent.
评论 #25452072 未加载