title: Improving DSL syntax
body: <p>To start learning design of DSLs using Kotlin language features, I have
  the attempt below at a toy DSL for creating groups of members with members
  having names. I am looking for pointers/hints on the following</p>
  
  <ol>
  <li>How can I avoid having to separate groups by a semicolon, if no semicolon the compiler gives</li>
  </ol>
  
  <blockquote>
    <p>Groups.kt:31:45: error: unresolved reference: member
      val grp = group { member { name ("Bob") } member { name ("Sandy") } }</p>
  </blockquote>
  
  <ol start="2">
  <li><p>Can i get to use a lambda for setting <code>name</code> instead of function call?</p></li>
  <li><p>Can I avoid having to have <code>name</code> be mutable in class <code>MEMBER</code>?</p></li>
  </ol>
  
  <p>My code is</p>
  
  <pre><code>fun group(create: GROUP.() -&gt; Unit) = GROUP().apply(create)
  
  class GROUP {
      private val members = mutableSetOf&lt;MEMBER&gt;()
  
      fun member(create: MEMBER.() -&gt; Unit) {
          val member = MEMBER()
          member.create()
          members.add(member)
      }
  
      override fun toString() = members.toString()
  
  }
  
  class MEMBER() {
      var name = ""
      set(value) {
          field = value
      }
  
      fun name(nameToSet: String) {
          name = nameToSet
      }
      override fun toString() = "MEMBER(" + name + ")"
  }
  
  fun main(args: Array&lt;String&gt;) {
      val grp = group { member { name ("Bob") }; member { name ("Sandy") } }
      println(grp)
  }
  </code></pre>
  
  <p>Currently the output of above code is</p>
  
  <blockquote>
    <p>[MEMBER(Bob), MEMBER(Sandy)]</p>
  </blockquote>