- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Re: Parsing and semantically analyzing scala itself
On Tue, Dec 16, 2008 at 9:18 AM, Tharaka Abeywickrama<tharakawick [at] gmail [dot] com> wrote:
> I have two questions:
> 1) How do you parse scala itself, including semantic analysis that does type
> resolution etc. My goal is to build a static analysis tool for scala that
> does thorough inter-procedural analysis. Do you have anything comparable for
> scala that matches the Java AST/DOM provided by the eclipse platform?
The scala compiler uses an abstract syntax tree internally. You can
write a compiler plugin in order to get access to it. There is a guide
about that on the link sent by Alex, but as David has noticed, it is
no easy feat.
Depending on the kind of analysis you want to do, you may have a look
at the package scala.tools.nsc.backend.analysis. It works on a control
flow graph intermediate representation.
> 2) How do you do annotation processing in scala? is there a tool that
> mirrors apt and gives you a DOM that represents the code?
You can write compiler plugins for that.