FParsec 中的示例语法超出了示例范围?
我正在寻找一些用 FParsec 编写的示例语法,这些语法超出了项目存储库中的示例。
我发现这个非常好 GLSL 语法,但这是我找到的唯一示例。我需要的是类似于 C 或 JavaScript 的语言的语法。
I am looking for some sample grammars written in FParsec that would go beyond the samples in the project repository.
I have found this very nice grammar of GLSL, but this is the only sample I found. What I need is a grammar for a language similar to C or JavaScript.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
卢卡·博洛涅塞 (Luca Bolognese) 撰写了一系列精彩的在 48 小时内用 F# 编写一个方案,他使用 FParsec 进行解析。包含详细测试用例的完整源代码在线
最相关的帖子是 第 6 个,他谈到了解析一种简单的类似 Lisp 的语言。正如您所知,这种语言更接近 JavaScript,而不是 C。
他博客上当前的系列是在 F# 中解析 lambda 表达式(使用 FParsec),这对您也有帮助。
Luca Bolognese has written a great series of Write Yourself a Scheme in 48 Hours in F# where he used FParsec for parsing. The full source code with detailed test cases are online here.
The most relevant post is 6th one where he talked about parsing a simple Lisp-like language. This language is closer to JavaScript than to C just so you know.
Current series on his blog is parsing lambda expressions in F# (using FParsec) which could be helpful for you too.
这里是 便携式游戏符号(PGN,国际象棋游戏的文件格式),使用 FParsec,称为 pgn.net
PGN 格式很容易理解,因此用例非常清晰。格式有很多变体(例如,走法是什么),因此有很多小例子。
Here is an implementation of a parser for the Portable Game Notation (PGN, a file format for chess games) in F# using FParsec, called pgn.net
The PGN format is easy to understand, so the use cases are quite clear. There are many variations of the format (e.g. what a move is) so there many small examples.