| Home | Downloads | What is a "HovpoH", anyway? | Klingon Calendar System | HovpoH Timeline | Sign our guestbook! | View our guestbook! | Links |
| Conversions | |||
|---|---|---|---|
| Convert calendar date | Convert HovpoH | Convert Klingon Calendar Date | Convert SuStel's Stardate |
| Time-Wasters | ||||
|---|---|---|---|---|
|
wa' cha' wa'maH The Warrior's Game |
Klingon Magic 8 Ball | E-Mail Signature Generator |
Dove® Wrapper Translation Project |
{var'aq} |
This tutorial will take you through the basics of var'aq programming, starting with a general introduction to var'aq, then presenting the currently implemented keywords using example programs with each lesson building on the previous one. By the time you finish this tutorial, you should be able to use and understand code written in var'aq.
It is imperative, if you haven't already, to download the current version of var'aq, available from The var'aq Homepage, and unzip it into it's own folder that you can get to easily. If you have difficulty getting the interpreter to work, be sure to follow the instructions found on my main var'aq page to help you get started.
This tutorial is not intended to be all-inclusive. It is just enough to give you a feel for how var'aq programming works.

This is the central piece of software needed for var'aq programming. There are actually two separate interpreters included with the current release: varaq-kling, the Klingon-language interpreter, and varaq-engl, the English language interpreter. This tutorial considers only the Klingon-languge interpreter. It is written in Perl, but you don't need to know Perl to program in var'aq, any more than you need to know the inner workings of a calculator to use one. The interpreter takes the code entered, and translates them into a language your computer understands. In Windows, the interpreter opens in a DOS window, and all coding is text-based.
1.3 Pushing tokens onto the stack
This is the most basic thing you will do in var'aq programming, and forms the basis for stack operations.
To push a token onto the stack, simply enter it into the command line, and press enter.
Ex:
Entering 6, then pressing enter will push the number six onto the stack.
An alternative method is to enter all the tokens on a single line, and the interpreter will go from left to right, pushing the separate tokens onto the stack one by one.
Ex:
Enter 12 27 74, then hit enter. The interpreter will push these three tokens onto the stack in this order : First "12", then "27", then "74", leaving "74" on top of the stack, as it was the last token pushed on to it.
If you have a string token, enclose it in quotes, or use the '~' operator. The latter is not recommended, as the quote operator ('~') is normally used only for naming processes.
Ex:
If you enter Scott, then hit enter, the interpreter will tell you that Scott is an undefined function. To push the string "Scott" on to the stack, enclose it in quotes, like this:
"Scott"
String tokens may contain whitespace, so "Scott" and "Scott Willis" are both equally valid string tokens.
1.4 Using the {Hotlh} keyword
This is strictly a debugging keyword. Do not use it in your finished programs. I present it here only because I will be referring to it throughout this tutorial to help the reader learn about stack dynamics.
Use:
Start up the interpreter, and push three tokens onto the stack, like this:
12 27 "Scott"
Then, enter Hotlh. The line of output will look like this:
12 27 Scott
This keyword leaves the stack untouched. It simply displays the stack.
Ex:
Push "Scott". Use Hotlh to verify it is on the stack.
It took the first item off the stack, put it onscreen, and discarded it.
Example Program: nuqneH 'u'
To further demonstrate the use of the {cha'} keyword, we will take an example from the var'aq Homepage code snippets page, albeit in a modified form.
~ nuqneH { "nuqneH 'u'" cha' } pong
Let's take this bit by bit.
Now call the function:
nuqneH
Output: nuqneH 'u'
The words mean, "What do you want, universe?" in Klingon.
Ex:
Push "Scott", then "name" onto the stack.
Using cher is like making your own keyword, only the keyword points to a value instead of a set of instructions.
cher can also be used to bind a string to a number.
699742.4 "HovpoH" cher
Example program: Loopy
To illustrate the cher keyword, will we look at a program that writes a sentence of the user's choosing to the screen as many times as the user indicates.
~ loopy {
Here's another way to send me e-mail!
Klingon™ is a trademark of Paramount, Inc. No infringement is intended.
This page is best viewed at a 800x600 resolution or higher
©2003 De'wI' joH'a'
Return to Table of Contents

Lesson 1: Introducing processes
First, we will consider:
Output: Scott
Then type in cha', and hit enter.
Output: Scott
Use Hotlh to verify that the stack is empty.
Output: BLANK LINEReturn to Table of Contents

Lesson 2: Declaring variables
This lesson will introduce the concept of var'aq variables. Even if you are familiar with variables in other programming languages, var'aq variables work a little differently, so it is still important that you read this section.
Input: "Scott" "name"
Type in cher
Verify that both "Scott" and "name" are gone from the stack using Hotlh.
Enter name cha'
Output: Scott
HovpoH cha'
Output: 699742.4
} pong
To view this page, you need the Klingon.ttf and KlingonDagger.ttf fonts.