title: Scala packrat parser
body: <p>I have some questions about Packrat parser combinator presented in Scala 2.8.</p>
  
  <p>Unfortunatelly I wasn't able to find any tutorials of how to use this new feature except of Scaladoc PackratParsers trait description, which is rather short. Could it be possible to receive an example of using it?</p>
  
  <p>Actually, I have no experiance in Scala. And the first problem I have found when trying to use packrat parser is implementing PackratReader class. Scaladoc said that a programmer should create this object manually like new PackratReader(new lexical.Scanner("input")). Therefore I wrote the following:</p>
  
  <pre>
  package proj
  
  import scala.util.parsing.combinator._
  
  class MyParser extends JavaTokenParsers with PackratParsers {
    lazy val expr: PackratParser[Any] = ident ~ "+" ~ ident
  }
  
  object TestApplication {
    def main(arguments: Array[String]) {
      val myParser = new MyParser 
      println(myParser.parse(
        myParser.expr,
        new PackratReader(new lexical.Scanner("x+y"))
      ))
    }
  }
  </pre>
  
  <p>And the compiler gave the error:</p>
  
  <pre>error: not found: type PackratReader
  new PackratReader(new lexical.Scanner("x+y"))</pre>
  
  <p>Therefore my second question is about how to implement(or instantiate if possible) PackratReader. Besides I'm also interested how to instantiate trait's inner classes like PackratReader mentiond in the prevous question?</p>
  
  <p>My last question is how to use together Packrat parser and regular Scala's parser combinators. Scaladoс said: "They can be free mixed with regular Parsers in a single grammar". Could you also explain how regular parsing rules which don't provide memoization will infuence packrat rules supporting it?</p>
  
  <p>Thanks.</p>