lex/yacc 和 fslex/fsyacc 有什么区别?

发布于 2024-08-21 10:14:12 字数 172 浏览 8 评论 0原文

我正在学习 F# 因为我想编写一个词法分析器和解析器。我对这种处理有一点经验,但确实需要像 F# 一样正确学习它。

在学习 F# 的词法分析/解析功能时,学习 lex 和 yacc 就足够了吗?

或者是否存在一些差异,意味着 lex/yacc 的代码无法与 fslex 和 fsyacc 一起使用?

I'm learning F# because I'd like to write a lexer and parser. I have a tiny bit of experience with this sort of processing but really need to learn it properly as well as F#.

When learning the lexing/parsing functionality of F#, is studying lex and yacc sufficient?

Or are there some differences that means code for lex/yacc will not work with fslex and fsyacc?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏有森光若流苏 2024-08-28 10:14:12

我个人发现了这些 OcamlLexOcamlYacc 教程优秀资源开始 - 易于理解,您可以几乎逐字翻译 FsLex/FsYacc 教程中的大部分内容。

I personally found these OcamlLex and OcamlYacc tutorials excellent resources to get started -- easy to follow, and you can translate most everything in those tutorials for FsLex/FsYacc almost verbatim.

甜嗑 2024-08-28 10:14:12

好吧,使用 lex 和 yacc,您可以将 C/C++ 代码放在“动作”中,而使用 fslex 和 fsyacc,您可以将 F# 代码放在那里,但我想您知道这一点吗?

我认为它们基于相同的(已建立的/古老的)标记化和解析技术,因此语法的一般结构/行为应该是相似的,如果这就是你所追求的......

Well, with lex and yacc, you put C/C++ code in the 'actions', whereas with fslex and fsyacc you put F# code there, but I presume you know this?

I think they are otherwise based on the same (established/ancient) tokenizing and parsing technologies, so the general structure/behavior of the grammar should be similar, if that's what you're after...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文