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?
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.
You're not supposed to use it. In fact, it has recently been deprecated.
See deprecation candidate: scala.parsing.ast
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With