Congratulations. We are nearly finished. On Linux, the finite-state applications you see in this
cd ~/for-linuxto go into the directory. Then enter the command
ls -lto make sure you have arrived at the right place. You should see this GettingStarted file and the five applications: xfst, lexc, lookup, tokenize, and twolc. The display should look something like this:
-rw------- 1 myname staff 13418 Mar 11 18:22 GettingStartedLinux.htmlThe -rwx------ signature in the beginning of the line indicates that you have the full rights to the file (read, write, and execute). Sometimes file permissions are not preserved when files are copied. If you see something other than -rwx------ in the beginning of the last five lines, enter the command
-rwx------ 1 myname staff 499248 Aug 11 2002 lexc
-rwx------ 1 myname staff 371432 Jun 13 2002 lookup
-rwx------ 1 myname staff 221688 Jun 13 2002 tokenize
-rwx------ 1 myname staff 424652 Jul 20 2002 twolc
-rwx------ 1 myname staff 686608 Sep 27 18:52 xfst
chmod 700 *to fix the permissions. You (and only you) should be able to read, write, move, or execute these files.
./xfst(note the period and the slash), the xfst application will start and you will see the xfst: prompt. To try out a simple command, you can type
read regex a b c;to make your first network. This is just a test, you can immediately quit with the command exit. To make the programs accessible from any xterm window, they should be copied to a directory that is on your "path", a list of directories that Unix searches to find the executable programs for you. Enter the command
echo $pathto see what directories you have on your path.
cd ~/for-linuxIf you don't have a ~/bin directory (~/ stands for the path from the top of the file system into your home directory), we recommend that you make one and move the programs there. To do that, enter the commands
mkdir ~/binThe mkdir command creates the folder bin in your home directory. If you already have a ~/bin directory, the mkdir command will tell you so, and do nothing. The mv command moves all the files in your current ~/for-linux directory into the ~/bin directory. To verify that all went well, enter the command
mv * ~/bin/
ls -l ~/bin/.You should see the five programs in their new location.
echo $pathshould show something terminating in ~/bin or /home/myname/bin in its output (different Linux installations may store the user home directories in different locations). If that is the case, enter the commands
rehashto make sure everything is installed correctly.
set path = (~/bin $path)and save the .cshrc file. If the file does not yet exist, type the following three lines
cat > ~/.cshrcwhere ^D stands for control-D. You now have a ~/.cshrc file that adds ~/bin to your path in every newly launched xterm application.
set path = (~/bin $path)
source ~/.cshrcto add the ~/bin directory to the path in the current xterm, followed by the commands
rehashIf the which command comes back with a path to the location where xfst was installed, all is well and you are done. You can now launch xfst by with the command xfst in any new xterm window. If xfst works, the other four applications, lexc, lookup, tokenize, and twolc, will also launch properly.
rm lexc lookup tokenize twolc xfst
Because of its Unix origins, all the applications assume that lines in text input files end with the Unix newline character "\n". Input files that terminate lines with "\r" (Macintosh) or with "\r\n" (Windows, DOS) cannot be processed with the CD versions of the software. If you have a source file created on a Macintosh, you can replace the end-of-line characters in Unix with the command
tr "\r" "\n" < inputfile > outputfileThe command
tr -d "\r" < inputfile > outputfileconverts a Windows/DOS document into Unix format.
Only ISO-8859-1 (= Latin-1) character encoding is supported by the CD versions of the software. 16-bit Unicode characters (UCS-2) are handled internally but they cannot be entered directly as input. For example, the Hebrew letter Alef can be represented as "\u05D0" in a regular expression where "\u" indicates that the following four Hex characters encode a Unicode symbol but the symbol will not be printed as the proper Hebrew character even if the computer has a Hebrew font installed.In the near future, we will make available new versions of xfst, lexc, lookup, and tokenize that are aware of different end-of-line conventions and are able to process UTF-8 encoded Unicode files. Please check out the book web site, http://www.fsmbook.com, for updates.