|TEA Language Reference||Index|
TEA (Tiny Embedded Application) is the language used to run programs directly on BrainStem® Modules. The BrainStem® virtual machine is also available for use on a host computer through the Console Application.
TEA is a very simple language with a syntax that is roughly the common elements of Java and C. The syntax is taken almost entirely from ANSI C so savy programmers will not likely need the reference once they get started. It is easy to learn and very useful for small tasks. Programs are limited by small stack and program space but can be quite efficient when carefully written.
A TEA Getting Started Guide is available on the Acroname website. Search for 'TEA Getting Started' in the find box in the upper-right of every page.
TEA is a nearly policy-free language. The language knows little about the I/O available on the particular device you are running the program on. All interfacing to I/O is through an IO Port Map. This port map offers 65535 distinct locations to read and write information allowing the TEA program to communicate with the world. These IO port locations are fixed so some will be implemented on some ports of the VM, some will not.
The Limits of TEA
TEA is meant to fit on absolutely tiny processors. This means there are some limitations. If you find yourself running against these limitations, your code should probably be running on the host computer and communicating with the Module via the link rather than trying to accomplish large tasks on the TEA vm.
One notable limit is text handling. Simple text support is provided to allow debugging and formatted output but this is costly in terms of virtual machine resources. Again, if you are stumbling into a wall, your code should probably migrate to the host computer for these functions.
The typical pattern is to edit your code using a text editor. Notepad, SimpleText, the Memo Pad, or any code editor will work well. These files can be moved between platforms without concern for line-feed characters, etc. These souce files typically have an extension of ".tea" and reside in the aUser area of the brainstem distribution.
Your code is then compiled using the "steep" compiler. This compiler has been built into the Console for your convenience. The steep compiler is a full recursive descent pre-processor, compiler, optimizer, and linker built into one. The output is a cross-platform ".cup" object file that can then be launched with the TEAvm or loaded onto the Stem. Compiling, linking, and loading are available as Console commands.
Many typical I/O issues and types are easily handled by small TEA routines that can be included in your programs. These routines are documented here with full descriptions and notes.