16

The only ways I am aware of, aren't "direct":

  • converting to ANTLR format and using its own visualizer
  • VISUALLANGLAB, which it seems to require an entire mouse-clicks "rewrite"
  • implementing a converter by myself (which would be funny, but time-consuming)
  • second link below

Related:

The second link suggests to debug adding an implicitly method to the parsers:

implicit def toLogged(name:String) = new { 
  def !!![T](p:Parser[T]) = log(p)(name)
}

May be an AST would be more feasible/usefull; but the question remains similar.

Community
  • 1
  • 1

1 Answers1

1

I might have misunderstood your question.

Scala parser combinators are used to parse strings to instances of types that you can use (either custom or built-in). The result is a structure of Scala instances that you decide, this could be anything.

You could create a parser that parses your arbitrary string into instances of a well known java structure for example ECore.

Without a usecase it's hard to suggest the best road for your problem. Maybe Xtext can help you: http://www.eclipse.org/Xtext/. Xtext has quite a few built-in features, however it's an Eclipse plugin and you might need something else.

EECOLOR
  • 11,184
  • 3
  • 41
  • 75
  • I am not good at terminology (Combinators etc.). My intent is to evolve my language interpreter already written in Scala (combinators + case classes + pattern matching). The syntax diagram would be mainly for debugging purposes. –  Feb 17 '13 at 00:14
  • 1
    Ahh, now I understand. I wonder, are looking for something that creates images of your case class instances or images of the structure that is represented by your combinators. The last one is very difficult because it's actually one big function (you would need quite a complex compiler plugin). The first one is doable, but not standardized. You could convert your case classes to a standard model like this: http://www.eclipse.org/Xtext/documentation.html#model_metamodel – EECOLOR Feb 17 '13 at 15:19