NUMPAD Interpreter

Basic Information

  Notice:  Copyright (C) 2002, Kevin P. Albrecht
  Version: 1.0 (for Windows 9x)
  Build:   0050
  Date:    10 Oct 2002
  E-mail:  kevin@albrecht.net
  Website: http://kevin.alteu.com/
 

Description

NUMPAD is an interpreter for the programming language of the same name. It interprets a file containing words using the rules below. This program is covered by an X11-style license, which means, in part, that the program and its source code is freely available for distrubution and modification, under certain conditions.

Usage

On the command line, type the following:

  numpad [ option(s) ] [ input file ]
 
The options are:

   Option           | Description
   -----------------+--------------------------------------------------
   -a, --about      | display release and contact info
   -l, --license    | display distribution license
   -v, --verbose    | print verbose information
   -o X, --output X | output intermediate code to filename X
   -c X, --calc X   | calculate the value for for the word X
 

NUMPAD Programming Language

1. Letter Values

NUMPAD is not like most languages. In the input file, everything except letters are ignored. The program is not case sensitive, which means that it does not differentiate between upper and lower case letters. Each word in the input file is changed into a decimal value corresponding to the sum of the values of each letter in the word, according to this chart:

  LETTER   VALUE
  ------   -----
  abc      2
  def      3
  ghi      4
  jkl      5
  mno      6
  pqrs     7
  tuv      8
  wxyz     9
  ____________________
 |      |      |      |
 |  1   |  2   |  3   |
 | abc  | abc  | def  |
 |______|______|______|
 |      |      |      |
 |  4   |  5   |  6   |
 | ghi  | jkl  | mno  |
 |______|______|______|
 |      |      |      |
 |  7   |  8   |  9   |
 | pqrs | tuv  | wxyz |
 |______|______|______|
The value of each letter corresponds to the number with that letter on a telephone keypad!

2. Word Values

After a word is given a value, it is interpreted to have a meaning based on that value. In the following chart, the value in the left column represents an instruction that is the first word in the "MEANING" column.

  VALUE    MEANING                     WHAT IT DOES
  -----    -------                     ------------
  2-10     set VAR (expression)        Puts the value from (expression) into VAR
  11-12    print (expression)          Prints the value from (expression)
  13-14    getn VAR                    Gets an integer from the user and puts it in VAR
  15-16    gets VAR                    Gets an string from the user and puts it in VAR

           (expression):
  17-18    stropen                     Marks the start of a string.
             CHAR CHAR CHAR ...
  19-20    strclose                    Marks the end of a string.

           (expression):
  21-22    number                      Marks the next word as a number.
             NUMBER

           (expression):
           VAR

  23-24    add VAR (expression)        Adds (expression) to VAR.
  25-26    sub VAR (expression)        Subtracts (expression) from VAR.
  27-28    mul VAR (expression)        Multiplies VAR by (expression).
  29-30    div VAR (expression)        Divides VAR by (expression).

  31-32    label LABEL                 Marks a label.
  33-34    goto LABEL                  Goes to the label.
  35-36    jlt VAR1 VAR2 LABEL	       Goes to LABEL if VAR1 < VAR2
  37-38    jgt VAR1 VAR2 LABEL	       Goes to LABEL if VAR1 > VAR2
  39-40    je VAR1 VAR2 LABEL          Goes to LABEL if VAR1 equals VAR2
  41-42    jne VAR1 VAR2 LABEL         Goes to LABEL if VAR1 does not equal VAR2

  43-50    RESERVED!!                  These values are reserved for future use.

  51       0                           number variable holding the value zero
  52       1                           number variable holding the value one
  53       newline                     string variable holding the newline character
  54+      VAR                         space for variables
 

The License of the NUMPAD Interpreter

Copyright (C) 2002, Kevin P. Albrecht

Permission is hereby granted by Kevin P. Albrecht (the "Author"), free of
charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the Author shall not be
used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from the
Author.