Language Features

1. Integer and Character Constants

Literal values may be decimal, hexadecimal, or octal. Single-character literals are also supported.

2. Global and Local Variables

Global and local variables are organized as two "variable pools" of 4,096 bytes each. One pool (of global variables) is visible to all. The second pool (of local variables) is only visible to it's owner (typically one local variable pool per function.) Variables can be 8-bits, 16-bits, or 32-bits long.

3. Memory Operations

Interp provides operators that can read and write 8-bit, 16-bit, or 32-bit memory locations, allocate and free blocks of memory, copy memory regions, read and write memory-mapped I/O ports, compare two memory regions, and search memory regions for multi-byte values.

4. I/O Operations

Interp supports formatted and unformatted output. Interp can read characters, numbers, and strings, and poll for input. Output operations traditionally originate from the data stack (i.e. you place the items to be output on the data stack prior to initiating the output operation.) Formatted output can optionally read directly from memory, format the value, output it, and move to the next memory location by incrementing or decrementing. This capability makes it much easier to display both homogenous data (raw memory), and structured memory (a mixture of strings, pointers, bytes, halfwords and words.)

5. Comparison Operations

Interp supports the usual comparison operators: less-than, less-than-or-equal-to, equal-to, not-equal, greater-than, and greater-than-or-equal-to. These operations may be combined in logical sequences using AND, OR, XOR, and NOT.

6. Stack Operations

Interp supports these stack operations: push, drop, copy, swap, over, rotate, pick, copy-two, drop-two, and depth.

7. Structured Programming Constructs

Interp supports if/then/else, and loop/while/end-loop structures to a nesting depth of 1,024.

8. Functions

Functions are the program execution unit within interp. Recursion is supported. The maximum call depth is 1,024.

9. Macroprocessor

This feature is a convenient way to provide customized commands for users that are easy to remember. It is also a very useful programming aid - it eliminates mistakes by substituting one macro name with a long string of interp commands.

10. Execution Environments

Because interp's default execution environment is embedded Linux, it has the same out-of-the-box command line support common to most Linux programs. For more primitive environments such as run-at-reset or running with a E-JTAG debugger, interp must be ported. A very insightful porting example can be found here.