Fei Luo
Fei Luo

Reputation: 37

How can I build AST from Scala code?

How can I turn scala program into AST and operate with it programatically, from java/scala?

Upvotes: 1

Views: 1341

Answers (2)

user238607
user238607

Reputation: 2468

I know this is an old question but you can have a look at scalameta :

https://scalameta.org/

Library to read, analyze, transform and generate Scala programs

Upvotes: 0

MGolovanov
MGolovanov

Reputation: 65

You can parse scala program source code.

Take a look to parboiled2 PEG parser. As an examle it have scala parser implementation

https://github.com/sirthias/parboiled2/tree/master/scalaParser/src/main/scala/scalaparser

Upvotes: 1

Related Questions