scala.util.parsing.ast.Binders 应该如何使用?
我目前正在 Scala 中实现一个小型编译器,当我进行上下文分析组件时,我发现了包 scala.util.parsing.ast
中的特征 Binders
(我是使用 Scala 2.9 RC),已记录在解析时启用名称绑定。这听起来很有趣,我已经在谷歌上搜索了很多,但我仍然不知道如何使用它。虽然我当然能够让我的抽象语法源自 Binders,但我不知道如何从那里继续。网上有使用的例子吗?
I am currently implementing a small compiler in Scala and while I was doing the component for context analysis I discovered the trait Binders
in package scala.util.parsing.ast
(I am using Scala 2.9 RC), which is Documented to enable name binding during parse time. That sounds very interesting and I have been googling around a lot, but I still have no clue how to use it. While I am of course able to let my abstract syntax derrive from Binders
I dont see how to proceed from there. Are there any examples of the usage on the net?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过谷歌搜索,我发现 此页面,这似乎是包含更多详细信息的文档的开发版本。不幸的是,我无法找到这些文档的在线(我的意思是,在源存储库之外)版本。
但我不确定您是否能在这个图书馆中找到您想要的东西。名称解析是一件相当微妙的事情,在解析过程中进行名称解析似乎是一个值得怀疑的想法。该库本身的文档强调它仅适用于名称解析相对简单的语言,否则可能无法扩展。此外,Scala 存储库中的解析示例都没有使用此类。
我会谨慎地避开这个未知领域,并在单独的后解析过程中设计绑定分析。
By googling a bit I found this page, which seems to be a development version of a documentation with more details. Unfortunately I was not able to find online (I mean, outside a source repository) version of these documentations.
I'm not sure however that you will find what you're looking for in this library. Name resolution is a rather delicate thing, and it smells like a questionable idea to do it during parsing. The documentation of this library itself highlights that it is only suitable for languages where the name resolution is relatively simple, and may not scale otherwise. Besides, none of the parsing examples in the Scala repository make use of this class.
I would cautiously avoid this uncharted territory, and design binding analysis in a separate post-parsing pass.
你不应该使用它。事实上,它最近已被弃用。
看
弃用候选版本:scala.parsing.ast
You're not supposed to use it. In fact, it has recently been deprecated.
See
deprecation candidate: scala.parsing.ast