Skip to content

maseev/adtdsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADT DSL

Build Status GitHub

DSL for your ADTs

adtdsl lets yout define your ADTs using the concise syntax of an internal DSL. Here's a little example of what you can do with it:

adt MyList {
  object Nil
  class Cons(head: Int, tail: MyList)
}

transforms into

sealed trait MyList

object MyList {
  case object Nil extends MyList
  case class Cons(head: Int, tail: MyList) extends MyList
}

How to build

  • Clone this repository
  • Run ./sbt publishLocal in the project folder to build the project and install it to the local repository

How to use

Add adtdsl library as your project dependency:

SBT
libraryDependencies += "io.github.maseev" % "adtdsl" % "0.1"
API
import com.adtdsl.AdtGenerator._

val input =
  """
    |adt MyList {
    |  object Nil
    |  class Cons(head: Int, tail: MyList)
    |}
    |""".stripMargin

val scalaCode = generate(input)

About

Concise DSL for your ADTs - Take-home coding assignment for Eldis Soft (http://eldis.ru/)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages