Forth Development Applications

I often use the following Open Source software during Forth program development.

Asciio

This perl application allows you to draw ASCII diagrams in a modern (but simple) graphical interface.

Asciio URL: http://search.cpan.org/dist/App-Asciio/lib/App/Asciio.pm

See my page using Asciio to visualise the Forth Stack

.--------------.
|  Data Stack  |
|--------------|
| next element |average @ + average !
| dup          |." data = " .
| dup          |minv @ < if--.
| dup          |              '------> minv ! ." (new minv) " or DROP after ELSE
| dup          |maxv @ > if---.
| dup          |               '---->  maxv ! ." (new maxv) " or DROP after ELSE
'--------------'

Graphviz

Flowcharting; Directed Graphs

_images/beeptest.png

Why Flowchart ?

When designing new programs I often find it difficult to visualise the complete solution, especially if it is complex. One method that has solved this for me is Graphviz.

Now, as long as I start graphing something, (usually the main aims of the program), I find that the smaller parts always seem to just fill themselves in and soon I have the overall structure of my initial solution.

Why Graphviz ?

Graphviz http://www.graphviz.org is open source graph visualization software.

Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and web design, machine learning, and in visual interfaces for other technical domains.

The Graphviz layout programs take descriptions of graphs in a simple text language, and make diagrams in useful formats, such as images and SVG for web pages; PDF or Postscript for inclusion in other documents; or display in an interactive graph browser. Graphviz has many useful features for concrete diagrams, such as options for colors, fonts, tabular node layouts, line styles, hyperlinks, and custom shapes.

These are the advantages that are important to me

  • Open Source, Graphviz is unlikely to disappear or become unusable

  • Text based, so the source is easily versioned in my SCM along with the application source code, keeping them together

  • Great documentation

  • Beautiful automatic graph layouts

  • Very configurable with many features

My method so far when designing a program is to list the main operations and then produce the graph. This is the least complex method I have found which produces the least cluttered graph. I can then play around until I’m sure I have what I want, with Graphviz providing the graph to assist my understanding of what I’m trying to create.

As they say, a picture is worth a thousand words.

Dotme flowchart generator

Because I use so many flowcharts, I have made a flowchart template generator using a shell script called ‘dotme’.

How does it work ?
  • download and uncompress dotme.tar.gz somewhere

  • configure the three user variable lines in “dotme” to suit your unix system, make it executable and place it in your path

  • type ‘dotme’ in any directory you wish to create a flowchart and you will be asked for a flowchart name, enter it. We will call it ‘flowchart’ for this example.

  • dotme will then create ‘flowchart.dot’ and a Makefile in the directory so make sure you don’t already have a Makefile in it !

  • type ‘make’ and Graphviz will compile the ‘flowchart.dot’ creating a ‘flowchart.png’ which will then be displayed.

  • alter the code in ‘flowchart.dot’ to suit your program, run make to display it … repeat until you’re finished.

Requirements:
  • Graphviz

  • sh

  • make

  • feh, xli, qiv or any picture viewer

Download The Dotme Tarball

dotme.tar.gz