Yet another syntax tree generator made with Ruby and RMagick








RSyntaxTree is a graphical syntax tree generator written in the Ruby programming language. It is basically a port of phpSyntaxTree created by André Eisenbach.

While phpSyntaxTree does not accept multi-byte characters as those in Chinese, Japanese, and Korean, RSyntaxTree handles text of any language as long as encoded in UTF-8 and fonts have been installed. Additionally, RSyntaxTree can output symmetrized tree diagrams, a functionality that is not implemented in phpSyntaxTree.

RSyntaxTree consists of an easy-to-use command-line app and a web-based interfaces made with Sinatra web framework.

Working web interface is available at .

For the latest updates and downloads please visit .

RSyntaxTree is distributed under the MIT License.


Enter a sentence in the labeled bracket notation into the text area above and click the “Draw” button. A graphical syntax tree will appear immediately. English, Japanese, Chinese, and Korean have been tested so far.

Every branch or leaf of a tree must belong to a node. To create a node, place a label right next to the opening bracket. Arbitrary number of branches can follow with a preceding space. To print opening or closing bracket itself, escape it with a backslash ('\[' and '\]')

There are several modes in which the connectors between terminal nodes and their leaves are drawn differently (auto, triangle, bar, and nothing). In auto mode, a triangle is used if the leaf contains one or more spaces inside (i.e. if it’s a phrase), but if it contains no spaces (i.e. if it is just a word), a straight bar will be drawn instead (unless the leaf contains a "^" symbol at the end which makes it a single-word phrase).

You can put a subscript to any node by putting the _ character between the main label and the subscript. For example, NP_TOP will be rendered as NPTOP. Or you can select the “Auto subscript” option so that nodes of the same label will be automatically numbered. (e.g. NP1, NP2)

RSyntaxTree is capable of generating PNG, PDF and SVG files. SVG is very convenient for those who want to modify output images on third party vector graphic software (such as Adobe Illustrator and Microsoft Visio).

Options “Font-style”, “Font-size”, and “Color” would be self-explanatory. You can change the appearance of the resulting image to suit your purpose.