RSyntaxTree
Yet another syntax tree generator made with Ruby and RMagick

Yet another syntax tree generator made with Ruby and RMagick
RSyntaxTree is a graphical syntax tree generator written in the Ruby programming language created by Yoichiro Hasebe.
The original version of RSyntaxTree was based on phpSyntaxTree by André Esenbach .
Command-line version of RSyntaxTree is available at GitHub.
Microsoft Office (Word, PowerPoint, etc.) now supports SVG
. Using SVG
is recommended for a better quality syntax tree representation on MS Office files.
<>
notation (e.g. Modal<>AUX
) [June 2018]Margin
to the image (0-120) [February 2018]Connector height
option [March 2018]Enter a sentence in the labeled bracket notation into Editor
area above and click
Draw PNG
button. See the sample input in Editor.
Every branch or leaf of a syntax tree must belong to a node. To create a node, place a label text right next to the opening bracket. Arbitrary number of branches can follow it after an intervening
white space. (You can create node lables containing white spaces using the <>
symbol. Thus Modal<>Aux
, for instance, will be rendered as Modal Aux
.)
There are four types in which Connector
s between terminal nodes and their leaves are drawn differently (auto
, triangle
, bar
, and none
). In auto
mode, a triangle is drawn for a leaf
containing one or more spaces (= a phrase). When a leaf contains no spaces (= a single word), a straight bar will be drawn instead (unless the leaf contains a ^
symbol at the end which makes it to be treated as a phrase).
In addition to the PNG
image format, RSyntaxTree is capable of generating PDF
and SVG
. SVG is very convenient for those who want to modify output images on third party vector graphic software such as Adobe Illustrator, Microsoft Visio, and BOXY SVG.
Symmetrize
option affects the way branching nodes are drawn. Options Font style
, Font size
, Connector height
, and Color
would be self-explanatory. Change values of these options to alter the appearance of the resulting image.
Style | Symbol | Sample Input | Output |
---|---|---|---|
Italic | *TEXT* |
*italic* |
italic |
Bold | **TEXT** |
**bold** |
bold |
Italic+bold | ***TEXT*** |
***italic bold*** |
italic bold |
Note that text-styles must be applied to the whole text of the node. Thus:
*abc def*
is OK, resulting in abc def*abc* def
is NG, resulting in *abc* def (no style applied)Styles are only applicable to non-CJK characters.
Decoration | Symbol | Sample Input | Output |
---|---|---|---|
Underline | -TEXT- |
-underline- |
underline |
Overline | +TEXT+ |
+overline+ |
overline |
Line-through | =TEXT= |
=line-through= |
line-through |
Note that text-decoration must be applied to the whole text of the node. Thus:
-abc def-
is OK, resulting in abc def-abc- def
is NG, resulting in *abc* def (no decoration applied)Text decoration is applicable to both CJK and non-CJK characters.
You can add a subscript to a node by separating the main part and the subscript part with a _
symbol. For instance, NP_TOP
will be rendered as NPTOP.
Sample Input | Output |
---|---|
main_subscript |
main subscript |
You can enable the Auto subscript
option so that nodes with the same label will be automatically numbered. (e.g. NP1, NP2)
You can apply both text style and decoration at the same time. It is further possible to add subscripts to the styled/decorated text. It should be noted that the order of application matters
Inside < Outside
Style Decoration Subscript
Here's a well-formatted example that is somewhat complex:
Sample Input | Output |
---|---|
+**V**+_*it* |
Vit |