The Language of Trees

The packages {@link tree} and {@link treelanguage} defines a "Language of Trees".

This is not a "programming language". It is a "data description" language, more like XML or JSON.

The grammar for this language is,

    Tree ::= '(' String Tree+ ')'
           | String
where {@code '('} and {@code ')'} are literals and {@code Tree+} means one-or-more sub trees.

The files

give simple examples of how to use the tree language to construct tree data structures.

Instead of writing out all the constructor calls for building an instance of a tree, which makes for fairly complex code, we can instead use a string to describe a tree and then build an instance of the tree from its descriptive string.

The file {@link Tree_Language} defines an interpreter for the tree language.

To build the interpreter, run (double-click)

   build_all_classes.cmd
then run
   build_jar_file.cmd
which builds an executable jar file for the interpreter program.

To run the interpreter jar file, on the command-line run

> Tree_Language.cmd
which runs the interpreter as a REPL (read eval print loop).

The files

are "script files" written in the tree language.

To run a script file using the interpreter, on the command-line run

> Tree_Language.cmd  script-1.tree
> Tree_Language.cmd  script-2.tree

You can use the Tree_Language.cmd shell script without opening a command-line window. This makes it easy to run the interpreter's jar file. If you double click on Tree_Language.cmd (after having built the jar file), it will run the interpreter as a REPL. If you drag-and-drop one of the "tree language scripts," script-1.tree or script-2.tree, onto Tree_Language.cmd, it will execute the script file.