0
votes

I have a language design background, and want to start porting a feature into the Play Framework (Scala version). However I'm having a hard time finding the methodology behind either sugaring or extending the core of the framework. So I have the following points to ask about Play's extension:

  1. AST Updates: Should I treat the Play as a language in the classical sense? In this case need to update the AST and code generation modules? Usually for language extension, I do extend the AST, and then update the code generation functions so that the new AST generates existing ASTs (don't invent the wheels again).

  2. Repository and Related Documentation: If point one holds, I look at the repository and I don't get any document for extending parser/code generation pipeline. The only available resources are the code themselves and their comments?

Note: I see that Play encourages writing modules for contribution, however the feature I would like to port, has a desperate need for using the AST at different stages of the compile time; which I do not think it is possible by using the modules.

1
I think this is the repo that you are looking for: github.com/playframework/twirl Twirl is the Payframework's tempalting language.The parser/compiler are both separate modules, I am pretty sure. The templating syntax is based on scala, so i guess you could say that yeah, it is its own language.IanGabes

1 Answers

0
votes

Play is a web framework not a language, twirl is just the template engine for actions output and Scala is the language you want to extend. Scala supports Macros http://docs.scala-lang.org/overviews/macros/usecases that will give you access to the AST to create your magic.

Good luck and surprise us with you new feature.