WL Programming Language Tutorial

WL in a nutshell for Java or C Programmers

A WL program is a Java method or C function named wain that has two int parameters and an int result.

Declarations, control structures and statements that may be used in WL are restricted to:

The clauses of if and while containing statements must be enclosed in braces (i.e. {}).

Expressions may contain only variable names, integers (written in decimal without a sign) and the binary (two operand) versions of the following operators:

    + - * / % == != <= >= < >
The // notation (and only the // notation) may be used for comments.

Example WL Program

//
// WL Program to compute:
//   a^b if 0 <= a,b < 10
//   -1 otherwise
//

int wain(int a, int b) {
   int counter = 0;
   int product = 0;
   product = 0-1;  // only binary minus
   if (a >= 0) {
      if (b >= 0) {
         if (a < 10) {
            if (b < 10) {
               product = 1;
               counter = 0;
               while (counter < b) {
                  product = product * a;
                  counter = counter + 1;
               }
            } else {} // must have else
         } else {} 
      } else {} 
   } else {}
   return product;
}