8th Tutorial

Lession 2: the 8th console

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

What, no IDE?

If you’re coming from other programming environments, you may be used to using an “IDE”. 8th doesn’t have an IDE — instead, it lets you choose the tools you prefer to use.

The developer of 8th prefers to use the incredibly powerful programming editor vim, while others prefer emacs or Notepad++ or Eclipse or any other plain-text editor… the choice is yours! Note that if you use an editor, it must save your 8th program as plain text and not (for example) as a word-processing format!

The power of 8th is in its interactive nature. To take full advantage of that, you need to explore the 8th console.

The 8th console

As you saw in the previous lesson, when you start 8th at the command-line without a file, it will display an “ok>” prompt. It is then waiting for you to type in commands. To make your life easier, 8th’s console has special editing keys. These are the keys which have special meaning in 8th’s console:

  • BKSP — delete the character to the left
  • Ctrl+A — move to the beginning of the line
  • Ctrl+C — cancel input
  • Ctrl+D — quit 8th
  • Ctrl+E — move to end of line
  • Ctrl+K — show help for the text before the cursor
  • Ctrl+L — clear the screen
  • Ctrl+Left — move one word left
  • Ctrl+Right — move one word right
  • Ctrl+V — paste from the system clipboard
  • Down — get next item from the “history”
  • END — move to the end of hte line
  • ENTER — accept the input (and process it)
  • ESC — cancel the current input, restore the original
  • HOME — move to the beginning of the line
  • Left — move left one character
  • Right — move right one character
  • TAB — complete the text before the cursor
  • Up — get previous item from the “history”

When you type something in the console and press ENTER, 8th interprets what you typed. But it also puts that text into the “history”. If you see you make a mistake entering text, you can use the UP and DOWN keys to scroll through the history to retrieve a prior command, which you can then edit using any of the editing keys listed above. This is a big time saver!

Try it. Type:

Exception: can't find: word: at offset 5 in console: …
8th didn’t understand ‘word’. You meant ‘words’, so press UP and add an ‘s’ and press ENTER. Isn’t that helpful?

The console does not usually save or restore the history. If you would like to do that, see the documentation for con:save-history and con:load-history.


Try the following:

  • Start 8th and type a phrase like 230 12 + and press ENTER
  • Now use the UP key and edit to change the + to a /
  • Press Ctrl+L to clear the screen
  • Now use the UP key and edit the original + phrase so it says 12 230 +


You’ve learned how to use the 8th console. Now it’s time to learn about the “stack”.