SixPairs.com SixPairs.com
A pandemonium of stuff about grammars, DSLs, graphs, povray, svg, xaml,
graphviz, intellipad, LaTeX, CLIPS, StringTemplate and Microsoft Oslo.
Back to Domain Specific Languages
Try it here

Tree Language

An embedded language to represent and draw multiway trees; you can use it to represent any tree in code and get either a "Tree" object or a depiction thereof in the form of a Control, Canvas or Xaml (or all of them). For instance, an organization chart for a fictitious company with a specific hierarchy like the following: "ceo (cfo (accounting hr planning) cio (operations it))" can be used as is as a Tree or rendered to Xaml or Canvas.

Here are some examples:
"ceo (cfo (accounting hr planning) cio (operations it))".ToInteractiveTree() → Control
"ceo (cfo (accounting hr planning) cio (operations it))".ToCanvas() → Canvas
"ceo (cfo (accounting hr planning) cio (operations it))".ToXaml() → Xaml
"ceo (cfo (accounting hr planning) cio (operations it))".ToTree() → Tree

To get the "Tree Language", send an e-mail to Ceyhun Ciper.

"ceo (cfo (accounting hr planning) cio (operations it))".ToCanvas() and .ToInteractiveTree() produce:
Organization Chart Organization Chart

So, one can simply printf to a string and immediately obtain a tree along with its drawing.

Documentation

Here is the "Tree Language Developer's Guide".

Use Cases

Contact Ceyhun Ciper
© 2009 Ceyhun Ciper
ceyhunc@gmail.com

Notes:
For more information and examples on tree drawings and representations, c.f. Wolfram Research's Mathematica and TreePlot site. You can use it as alternative to tree drawing and representation in Visio.