Let's install foma. We will also establish a workflow that includes a workaround for the finicky "view" command. Instructions below.
Windows users
Download GraphViz zip file "windows_10_msbuild_Release_graphviz-9.0.0-win32.zip"
from here, unzip it, then move the "Graphviz" folder into C:\Program Files (x86)\
Download Foma zip file "foma-0.9.18_win32.zip" from here, unzip it, rename the folder name "foma-0.9.18_win32" to "Foma", then move it into C:\Program Files (x86)\
Add the two applications to system PATH. Here's how.
On my laptop, the two applications' executable paths are as below. You should verify yours.
Is your .png image too small? Try adding the -Gdpi=192 option in your dot command, which doubles up the image dimensions by changing the dpi value (default is 96).
For the "view" command to work within foma, you will have to go over to the Linux side, which we can now run within Windows 10. First, install Linux: Pick Ubuntu, 20.04 worked smoothly for me. Then, within Ubuntu terminal, update your package manager sudo apt update, install graphviz: sudo apt install graphviz, and finally install foma: sudo apt install foma-bin. You also need a graphics viewer: sudo apt install gpicview. Crucially, you need an X Windows manager: VcXsrv comes highly recommended. You launch it via X-Launch; pick "Multiple windows", and for Display number specify "0". Finally, fire up a Ubuntu terminal, set display with export DISPLAY=:0, then start foma. The "view" command will now work!
Mac users
First, check your OS X version. Versions 11, 12, 13 ("Big Sur", "Monterey", "Ventura", "Sonoma") are fine; if you have version 10, make sure it's 10.14 or later ("Mojave" or "Catalina"). Steps:
Install homebrew, if you don't have it already. Make sure you complete the very last step of adding homebrew to your OS's PATH (see this screenshot).
In Terminal, install GraphViz through homebrew: brew install graphviz
Install foma: brew install foma
In Terminal, run foma. Create a regex. Instead of "view", use: print dot > fst.txt (see workflow below)
In another Terminal, use command: dot fst.txt -Tpng -o fst.png ; open fst.png (see workflow below)
Is your .png image too small? Try adding the -Gdpi=192 option in your dot command, which doubles up the image dimensions by changing the dpi value (default is 96).
For the "view" command to work within foma, you also need graphviz-gui. Unfortunately this package is not available through homebrew; you need to install and use MacPorts: port install graphviz-gui. In my case, I needed to install Xcode before MacPorts, which took forever and took up 7GB of space. So, this may or may not be worth your time.
If you are working with an older version of Mac OS, such as 10.12 "Sierra" and 10.13 "High Sierra", you have options. (1) Follow the same instructions noted above for 10.14 or later, or (2) try steps below, which are more involved but will let you use the "view" command.
You should have Xcode and homebrew installed on your system. It took me 1+ hour to install Xcode, just FYI.
In Terminal, install GraphViz through homebrew along with its app: brew install graphviz --with-app
You need to do some system-side housekeeping. See this stackoverflow post, the answer by Eliot with 40 votes.
Install foma: brew install foma
In Terminal, run foma. Create a regex. The "view" command will work. (see workflow below)
If you have an even older version of Mac OS, as the very last resort you try this pre-compiled binary, but graphing won't work.
Linux users
Install Graphviz and then foma. On Ubuntu, foma can be installed via apt install foma-bin. If your system knows how to handle .png files, "view" will work from within foma. Your workflow will be like this (image from my WSL setup).
Explore
Follow the "Getting started with foma" tutorial, listed under the "Documentation" section in the foma home page. There are three exercises: turn your solution into a graph image, and paste them in a word-processed document. A few additional pointers:
Need to quit foma? Type in "exit" followed by ENTER. That kicks you back into your command-line environment.
Make sure to substitute the "view" command with the "print dot --> convert to png --> open image" routine above.
Avoid going into the "up" and "down" modes, which can be hard to get out of (Ctrl+D usually works). Instead, supply a word argument with up and down: up buses, down bus[PL].
+ is a special regex symbol, so you will need to escape it.
Defining a regular expression (def NAME REGEX ;) does not in fact push it onto the stack, which is necessary before you can test it out. For this, you should follow up with the push command, as in push NAME
In fact, going the other way is more intuitive: first create a regular expression onto your stack through regex a|b|c|d ;, test it out, and when you are satisfied, give it a name through define. Screenshot here.
Is your stack becoming too high? Use clear stack
Having trouble? Check the "Common mistakes" section at the bottom of the tutorial.
SUBMIT:
A word-processed document (MS Word) containing your FST graph images. PDF version is fine too.