scala-yinyang / scala-yinyang   0.2.0

BSD 3-clause "New" or "Revised" License GitHub

Library for deep embedding of DSLs based on Scala macros.

Scala versions: 2.11

Yin-Yang: Building DSLs in a Breeze!

Join the chat at https://gitter.im/scala-yinyang/scala-yinyangBuild Status

Yin-Yang is a library that makes it easy to use and develop deeply embedded DSLs. The DSL users will never see the complex artifacts of the deep embedding while in production they will get all their benefits. The DSL authors write the DSL in plain Scala and Yin-Yang will generate the deep embedding. All that DSL users need to do are the domain-specific optimizations.

DSL Users will never know that the DSL is deeply embedded as they can debug and prototype their code. For example:

vectorDSL {
  Collection(1,2,3) map (_ + 1)
}

DSL Authors will develop their interface in regular Scala:

object Collection {
  def apply[T](els:T*) = ...
}
class Collection[T](elements: Seq[T]) {
	def map[U](f: T => U) = ...
}

And Yin-Yang will generate the nasty Rep[_] types, IR nodes, and cakes.

Support

If you encounter any issues with Yin-Yang please report them here.

Development

If you have any questions about the project please ask them in the development mailing list.

Project Structure

Component Description Stability
components/core The core transformers of Yin-Yang (regular release) Release(soon)
components/yin-yang The main Yin-Yang transformer used for defining your DSLs Release(soon)
components/paradise provides annotations for virtualization Experimental
components/dsls Small DSLs used for experimentation. Experimental

Building the Project

To build Yin-Yang you will need SBT 0.13.x. Just invoke:

sbt package

To use Eclipse invoke:

sbt eclipse

In Eclipse use the Import Wizard to import Existing Projects into Workspace

Note: Eclipse does not support long running macros. The test cases that reify DSLs at compile time will be practically impossible to navigate in Eclipse.

License

Yin-Yang is licensed under the Scala License.