8th Tutorial

Lession 1: starting and stopping

Starting 8th

Note: if you haven’t yet installed 8th, please do so right now and follow the installation instructions as presented in the manual!

8th is started from the “command-line” of your system. On Linux, Raspberry Pi or macOS that means opening a “terminal”, while on Windows you would start the “command prompt”. Some relevant links on how to do that:

Open the “command-line” and change directory to where you installed 8th. For the purpose of this tutorial we’ll call that “the 8th folder”. You can start 8th simply by invoking it by name:

8th
8th 16.04 macOS 64 (abcdef09) custid: xxyyzzaa ok>

Note that 8th told you a bit about itself: the version number, OS and build-version, as well as your customer id. Note too that it’s sitting patiently waiting for you to do something: that’s what is meant by the ok> prompt it displays. If instead you saw something like “Unknown command: 8th”, you didn’t put the 8th executable on your PATH — so you either need to do that or use the full path+name of your 8th executable. For our purposes, we’ll assume that 8th by itself is sufficient.

Now that you’ve got 8th running and waiting for you to do something, tell it to quit by typing the word “bye”:

bye
That quits out of 8th and returns you back to the system “command-prompt”.

As you can see from this short sample, 8th takes input from your keyboard. It can also read input from a file, or from the “standard input”. For example, using any text-editor you like, create a file called example.8th and put the following text in it:

"Hello" . cr bye
	
Next, “run” that file like so:
8th example.8th
Hello
Note that 8th read the “example.8th” file and interpreted the contents as 8th code. The contents, apparently, printed “Hello” to the console and quit 8th. If you hadn’t put bye in there, 8th would have continued waiting for your input. You could also have run the file like this:
cat example.8th | 8th
(Windows users substitute type for cat)

8th command-line options

As with most “command-line” programs, 8th has a number of “options” which it understands. To see the full list of options, type 8th -h. The most commonly used option is simply to name a file on the command-line. In that case, 8th assumes it should read and evaluate the named file.

Exercises

Try the following:

  • Start 8th and quit it by typing the word bye in its console
  • Start 8th and quit it using the -e command-line option and the bye word
  • Take a look at the command-line options 8th has and try to understand why you might use them

Conclusion

You can now start and stop 8th. Now it’s time to get comfortable with the 8th console.