About Plant

Plant is a toy programming language for branching drawing with primitives and is especially useful for drawing things like plants. In addition to creative drawing, it demos how to build a simple language in ANTLR runnable in browser via Javascript. This page describes Plant at a deeper level both for those hoping to use Plant and those seeking to learn from it to make their own domain specific languages. Plant is built by Sam Pottinger. Code and documentation available on Github.

Things used in Plant

Plant as a language draws inspiration from Logo, Processing, and shell scripting. It uses as close to vanilla JS as possible. It also uses the following technologies:

It also incidentally uses the following during build as required by ANTLR:

Why Plant

Plant isn't really meant to be practical. It's just a way to draw things with lots of branching or fractal-like structures. It also is meant to be a a very simple language which shows why "domain specific languages" are important. These are languages which aren't meant to necessarily be turing complete (can't do everything a normal langugae would do) but accomplish some very specific task well.

The "shape" of languages (like any tool) changes the way one thinks about how they are used and what they are used on. Plant tries to show how, by changing the way one describes a drawing, it makes it easier to think in branching structures and build branching drawings.

This DSL, like others, attempts to make it more "efficient" to work through a specific problem compared to general purpose languages. If you are interested in making your own domain specific languages, code and documentation are available on Github.

How is Plant built?

Plant is meant to inpsire others to build their own domain specific languages. Therefore, it has a very simple ANTLR language definition and uses as few libraries as possible. Most of it uses vanilla JS.

This project compiles its JS alongside the ANTLR JS runtime using a standard node stack. Finally, vanilla JS runs an online editor where that code has heavy documentation for expansion. Of particular interest are the visitors where code generation actually happens.

It can be built by cloning the repository, saving the ANTLR jar to the language subdirectory, running make.sh in the root directory, and starting a web server in the demo subdirectory (python -m http.server 9000 would do!).