title: Understanding the tilde in Scala's parser combinators
body: <p>I'm fairly new to Scala and while reading about parser combinators(<a href="http://www.codecommit.com/blog/scala/the-magic-behind-parser-combinators">The Magic Behind Parser Combinators</a>, <a href="http://ofps.oreilly.com/titles/9780596155957/DomainSpecificLanguages.html">Domain-Specific Languages in Scala</a>) I came across method definitions like this:</p>
  
  <pre><code>def classPrefix = "class" ~ ID ~ "(" ~ formals ~ ")"
  </code></pre>
  
  <p>I've been reading throught the API doc of scala.util.parsing.Parsers which defines a method named (tilde) but I still dont't really understand its usage in the example above.
  In that example (tilde) is a method which is called on java.lang.String which doesn't have that method and causes the compiler to fail.
  I know that (tilde) is defined as</p>
  
  <pre><code>case class ~ [+a, +b] (_1: a, _2: b)
  </code></pre>
  
  <p>but how does this help in the example above?</p>
  
  <p>I'd be happy if someone could give me a hint to understand what's going on here.
  Thank you very much in advance!</p>
  
  <p>Jan</p>