MoDAL (Mobile Document Application Language)

MoDAL is a user-interface description language (and a runtime interpreter) for palm computers with wireless network connection. It allows users to define a user interface for an arbitrary computer service. MoDAL provides users with a mechanism for associating user interface elements with the methods of network services. MoDAL interconnects with the network of services via TSpaces. TSpaces enables MoDAL to bring the unlimited computing power to PDAs.


  1. Overview
  2. System Requirements
  3. MoDAL Package
  4. Running MoDAL
  5. Example Programs
  6. MoDAL Grammar
  7. Frequently Asked Questions
  8. Contributors

1. Overview

MoDAL is being developed as part of the vision of Universal Information Appliance (UIA). UIA is a concept that will allow a user with a PDA to control devices and access any information available in the network by learning the environment in which the PDA is used. A user of a MoDAL enabled PDA will be able to acquire interfaces for devices and information agents, which we call services, in the environment and control them. These services provide defined user interface elements, being interconnected via TSpaces.

A MoDAL application program presents the user with the client interface to a specific service. The services available to a MoDAL user may be programs of any complexity from a simple one which turns a light on or off to a highly complex applications involving smart inference on many related events occurring in the system. TSpaces is the backbone middleware that we are using to make this happen. We envision a future where the user of a small PDA, rather limited in its hardware and software capability, is enabled and powered by TSpaces and MoDAL so that it can take full advantage of ubiquitous services in the distributed world.

This package includes a MoDAL interpreter, a Java proxy program, and a set of example MoDAL programs which, running on the Palm Emulator, talk to services through TSpaces. A user may also write and run his/her own MoDAL programs using this package. While the version being distributed in this package is still under development and implements only a subset of MoDAL, it demonstrates the potential capability of Modal as a tool for TSpaces's mobile clients.


If you prefer, you can also run MoDAL using a real PDA such as IBM Workpad and 3Com PalmPilot instead of the emulated environment. There are two possible configurations that can be used. One is to use a wireless modem supporting TCP/IP. We used Minstrel wireless modem to run MoDAL. The other method is to use the cradle to connect IBM Workpad to the network. This configuration currently works only for Windows NT. For more information on the use of cradle with Windows NT, please refer to the web page at

2. System Requirements

  1. Windows95, 98, NT, Linux, AIX, or Solaris
  2. Java JDK1.2 or higher
  3. TSpaces Version 2.02 or higher
  4. Palm Emulator(POSE) Version 2.1d26 or higher
  5. Palm OS Debug ROM (Palm OS 3.0 or higher)

The POSE and Palm OS ROM may be downloaded from a Palm developer site. While we have done much testing using POSE and Palm OS ROM, you can also use Xcopilot instead of the POSE and ROM to run MoDAL. The purpose of using a Palm emulator is only for the convenience of running the demo programs. If you have a wireless modem that allows IBM WorkPad or Palm Pilot to connect to the network via IP, you can also run MoDAL and application programs using the real hardware. We used a Minstrel Wireless IP Modem for testing. You can also run MoDAL using the cradle and IBM WorkPad or Palm Pilot on Windows NT.

3. MoDAL Package

The MoDAL software package is available at IBM's Alphaworks web site. The following is a description of the package and the instructions to run the MoDAL demos included in the package.

4. Running MoDAL

To run a MoDAL application program, you must first run a MoDAL interpreter, a TSpaces server and a Java proxy. The MoDAL interpreter may be loaded before or after the other components are started. A MoDAL program running on a PDA interacts with TSpaces via the Java proxy. The proxy is a server which provides MoDAL users with services such as login, service discovery, and TSpaces. While each of MoDAL, proxy, and TSpaces may be run on a different machine, it is also possible to run all of them on a single machine.

Here are the recommended steps to follow to run MoDAL programs. We will assume that the user runs the Java proxy on Windows. The required change for Unix should be obvious.

  1. Run a TSpaces server


  2. Run the Java proxy

  3. Load the MoDAL interpreter into your PDA.

    It is also possible to run MoDAL on a real PDA such as IBM Workpad or 3Com Palmpilot. There are two possible configurations that can be used. One is to use a wireless modem supporting TCP/IP. We used Minstrel wireless modem to run MoDAL. The other method is to use the cradle to connect IBM Workpad to the network. This configuration currently works only for Windows NT. For more information on this, please refer to the The TSpaces Pilot Proxy Page


    Once, modal.prc is loaded into your PDA, you don't have to load it again unless you hard rest your PDA.

  4. Perform login to the proxy.

    Once the MoDAL interpreter runs, you will be prompted for login user information. You will be asked to provide host id of your Java proxy with your user id and password. This information is required by the Java proxy on the specified host to check if you are a valid user. The current implementation will display the login screen with default values:

    You may also run the Java proxy on a remote machine by specifying its host id. For simplicity, we will assume the default values shown here will be used. All example Modal application programs included in this package will run with this setting.

    By clicking on the "OK" button, you will be logged in to the proxy. The MoDAL Desktop screen which allows you select a particular service will appear on the screen.

  5. Find the services available on the TSpaces.

    A service is a MoDAL program. In the general TSpaces model, the services available to a particular user will be determined by the service discovery service of TSpaces, which is being developed.

    Any TSpaces client will be able to query the TSpaces service discovery service for the services it wants to use. For the demos in this package, we will assume that the Java proxy performs the query for and makes the service information available to MoDAL clients. A MoDAL client can simply query the list of available services by selecting "Remote" option on the pop-up list, which can be displayed by the pop-up list icon located on the upper right corner of the MoDAL Desktop screen.

    If the login procedure was successful, this action will cause the list of available services (MoDAL application programs) to be downloaded from the Java proxy and displayed on the screen of POSE. The implementation of the current proxy assumes that all service programs are stored in Modal\ProxyPC\Modal, where the first Modal in the path is the top level directory for all Modal files.

  6. Run a MoDAL application program.

    A Modal application program is launched by selecting it from the MoDAL Desktop and pressing "Launch" button. The source code of the selected Modal program is sent to the MoDAL interpreter by the proxy on this action. The current MoDAL interpreter usually takes a few seconds to load a MoDAL application program and the time to load a program visibily increases as the program size increases. This is mainly due to its quick and dirty nature of the implementation. The programs will run much faster in the future. When the application is loaded and run, you will get an application specific user interface on the screen.

When you finish running the current MoDAL application, you will be returned to the MoDAL Desktop screen. This will let you select the next application to run in the same way as you did for the previous application.

When you run MoDAL applications, you can view the tuples being written to the TSpaces using a web browser. Tuples written to a TSpaces may be browsed by opening http://localhost:8201/Debug. the following page with a web browser, where localhost may be any host name on which the TSpaces server is running. A more detailed information on this utility may be found in the TSpaces Programmer's Guide.

5. Example Programs


This program sends a page to a designated party. When the user sends a page using this program, a page is written to the TSpaces.

A paging service program relays it to the designated party. For the demo of this program, we included a sample paging service program written in Java. One can display a page sent by Pager.xml using the program "PagerSim" included the package.

Once a TSpaces server is running, you can start a pager simulator by typing the following command within the directory Modal\PagerApp:

     java PagerSim pagerID [host id]

This command will cause the program to listen for "pagerID."

This program writes a page request to the TSpaces. A page request consists of two values that should be provided by the user: pagerID and message. For simplicity, we will use a string name as pagerID. When the user presses "Send" button at the bottom left corner in the Pager interface, a tuple consisting of the two values as its fields is sent to the Proxy, which write the tuple to the TSpaces called TransTupleSpace. When the message is sent to the TSpace, the PagerSim program running on a local computer, will display the message using a pop-up window with a sound.

Program: pager.xml
This program sends a page to TSpaces. The page format is
<receiver name, message>, where receiver name and message are any arbitrary strings.

<APPLICATION name = "pager">
<FORM name="main" label="Simple Pager" x="0" y="0" height="160" width="160">
<DBDEFINE name = "TupleForPager" >
<FIELD name = "Key" class = "STRING" />
<FIELD name = "Val" class = "STRING" />
<LABEL name="instLabel" label="Enter a receiver name and a message." x="0" y="25"/>
<LABEL name="PagerIDLbl" label="Name: " x="2" y="45"/>
<LABEL name="MessageLbl" label="Message: " x="2" y="70"/>
<TEXTFIELD name="PagerIdFld" label ="" x="45" y="45" height="12" width="100" maxchars="30" />
<TEXTFIELD name="MsgFld" label ="" x="45" y="70" height="12" width="100" maxchars="30" />
<BUTTON name="sendButton" label="Send" x="10" y="125" height="12" width="40">
<SET name="TupleForPager">
<ATTRIB name="Key" value="PagerIdFld.label"/>
<ATTRIB name="Val" value="MsgFld.label"/>
<TSEND name="TupleForPager" />
<BUTTON name="clearButton" label="Clear" x="60" y="125" height="12" width="40">
<SET name="PagerIdFld">
<ATTRIB name="label" value=""/>
<SET name="MsgFld">
<ATTRIB name="label" value=""/>
<BUTTON name="exitButton" label="Exit" x="110" y="125" height="12" width="40">

A Modal program consists of one or more form definitions. MoDAL requires that one of the forms have a name called "main." A form is defined by the FORM tag. A form definition may contain one or more definitions of visual objects such as LABEL, TEXTFIELD, BUTTON. Other types of visual objects are currently being implemented. A form may also define one or more tuples of variables. The DBDEFINE tag defines a tuple. Each field within a tuple is a variable whose value can be read and modified within the program. The current implementation only supports STRING type. A visual object definition may have an ACTION block, which defines the actions to be taken when the object is clicked on. In this example, we use actions such as APPSTOP, FORMGOTO, SET, TSEND, which means stop, replace the current form in the screen with a new form, assign values to variables, and write a tuple to the TSpaces.


This program turns on and off a light that is connected to a network via an X10 control device. It sends ON and OFF commands to the TSpaces in response to the pressing of On and Off button on the screen. The user can control the state of a light using a service program listening for these events. For further information on X10 device control, please refer to the X10 related files in the TSpaces package.


We have built a printer service which allows MoDAL user to print a file known as its URL using a printer residing in the network. The user can print files using printers for which the PDA does not have drivers. When the user specifies the printer to use and the URL of a file to be printed using the form on the screen, the request is transformed into a tuple and written to the TSpaces. A printing service program reads this request and perform the printing.


This is a generic tuple writer program. The program writes a tuple consisting of two fields to the TSpaces.


This program is a generic tuple reader. It reads a tuple of two fields. The first field is used as the search key.


This program is an example of multiple form application. A MoDAL program may have more than one form. This program consists of two forms: read and write. The user may switch back and forth between these two forms. These forms are used to write and read tuples with three fields.


This example is almost same as ReadWrite3.xml except that we increased the number of fields in a tuple to four.

6. MoDAL Grammar

MODAL ::= MStart_Statement MBody MEnd_Statement EOF
MStart_Statement ::= '<' 'APPLICATION' + NAME_ATTRIB ( OWNER_ATTRIB)? '>'
MBody ::= MForm ( MForm* | MMenu* | MHelp*)*
MEnd_Statement ::= '<' '/' 'APPLICATION' '>'
MForm ::= MFormStart MFormBody MFormEnd
MMenu ::= MMenuStart MMenuBody MMenuEnd
MHelp ::= '<' 'HELP' + NAME_ATTRIB LABEL_ATTRIB '/' '>'
MFormBody ::= ( MTxt* | MBttn* | MChkBx* | MChkBxGrp* | MLbl* | MLst* | MPopUp* )*
MFormEnd ::= '<' '/' 'FORM' '>'
MTxt ::= MTxtStart MAction MtxtEnd
MBttn ::= MBttnStart MAction MBtnEnd
MChkBx ::= MChkBxStart MAction MChkBxEnd
MChkBxGrp ::= MChkBxGrpStart MChkBx+ MChkBxGrpEnd
MLst ::= MLstSart MAction MLstEnd
MPUStart ::= MPUStart Mlst? MPUEnd

MTxtEnd ::= '<' '/' 'TEXTFIELD' '>'

MBttnEnd ::='<' '/' 'BUTTON' '>'
MChkBxEnd ::= '<' '/' 'CHECKBOX' '>'
MChkBxGrpStart ::= '<' 'CHECKBOXGROUP' + NAME_ATTRIB '>'
MChkBxGrpEnd ::= '<' '/' 'CHECKBOXGROUP' '>
MLstEnd ::='<' '/' 'LIST' '>'

MPUEnd ::= '<' '/' 'POPUP' '>
MMenuStart ::= '<' 'MENU' NAME_ATTRIB '>'
MMenuBody ::= MSubMnu MSubMnu*
MMenuEnd ::= '<' '/' 'MENU' '>'
MSubMenu ::= MSubMnuStart MItem MSubMnuBody* MKeyBoard? Mgraffit? MSubMnuEnd
MSubMnuStart ::= '<' 'SUBMENU' + LABEL_ATTRIB '>'
MSubMnuBody ::= ( MItem | MSeparator )
MSubMnuEnd ::= '<' '/' 'SUBMENU' '>'
MItem ::= MItemStart MAction+ MItemEnd
MSeparator ::= '<' 'SEPARATOR' '/' '>'
MItemStart ::= '<' 'ITEM' S+ LABEL_ATTRIB '>'
MItemEnd ::= '<' '/' 'ITEM' '>'
MKeyBoard ::= '<' 'KEYBOARD' '/' '>'
MGraffit ::= '<' 'GRAFFITI' '/' '>'
MAction ::= MDBRead | MDBWrite | MDBDelete | MTQuery | MTSend | MFrmGto | MGet | MSet |

SAVE_ATTRIB ::= 'savebehind' EQ BOOL_STR
MXCHR_ATTRIB ::= 'maxchars' EQ NUM_STR
SNGL_ATTRIB ::= 'singleline' EQ BOOL_STR
EDIT_ATTRIB ::= 'editable' EQ BOOL_STR
ULINE_ATTRIB ::= 'underline' EQ BOOL_STR
ASHFT_ATTRIB ::= 'autoshift' EQ BOOL_STR
SBAR_ATTRIB ::= 'scrollbar' EQ BOOL_STR
NUM_ATRIB ::= 'numeric' EQ BOOL_STR
VWROW_ATTRIB ::= 'visiblerows' EQ NUM_STR
BOOL_STR ::= '"true"' | '"false"'

7. Frequently Asked Questions

8. Contributors

Toby Lehman

Tobin J. Lehman (Toby) joined the IBM Research - Almaden in 1986, shortly after finishing his Ph.D. degree from the University of Wisconsin-Madison. Toby's research interests include server-based backup systems, Object-Relation database systems, large object management, memory-resident database systems, Tuplespace systems, and just about any cool thing written in Java. Toby is the leader of the TSpaces project and he plans to use TSpaces to make the world one cool and productive place.

Keung Hae Lee

Keung Hae Lee is a Visiting Scientist for the TSpaces group at IBM Research - Almaden and an Associate Professor in the Department of Computer Engineering at Hankuk Aviation University in Korea. He currently leads the development effort for MoDAL. His research interests include distributed objects, internet applications, and application architecture for handheld computers. He received his Ph.D degree in Computer Science from Virginia Tech in 1990 and worked for IBM from 1990-1993.

Dwayne Nelson

Dwayne Nelson joined IBM's TSpaces team as a software engineer in January of 1999. Previously, Dwayne has been a scientist at SAIC's Advanced Distributed Simulation / Research Team and a research assistant at IST's Visual Systems Laboratory (Orlando, FL). In August of 1997, Dwayne received his MS in Computer Science from the University of Central Florida with a survey of multi-agent systems and collective agent behaviors. Dwayne's interests remain focused on intelligent/adaptive and distributed systems.

Todd Hodes

Todd Hodes is a graduate student in the Ph.D. program at UC Berkeley. He recieved his M.S. from UCB in 1997, and his B.S. with high honors from the University of Virginia in 1994. His research interests are location-dependent applications for mobile devices, scalable service discovery/advertising, remote control of devices and applications, and composition of network services from heterogeneous clients.

Michelle Munson

Michelle Munson joined IBM in December 1998 after completing her masters in Computer Science at the University of Cambridge, UK. She graduated from Kansas State University in 1996 with degrees in EE and Physics. Michelle is interested in all aspects of distributed systems. She has recently developed an engine for distributed event programming to coordinate application components in a flexible, scalable fashion. She helped author the Universal Information Appliance vision, which describes the motivation and design of the MoDAL engine and presents a software framework for inter-operating the MoDAL application with a generic device or service on the network.

Miguel Guellin

Miguel Guillen is an Electronics Engineer who joined IBM in May 1991. He is a member of the Guadalajara Programming Lab in Guadalajara, Jal. Mexico. Miguel Guillen helped to write the MoDAL's formal definition, also, a first prototype of an interpreter of it running in an IBM Workpad. Mr. Guillen received his Bachelor's degree in Electronic engineering from the University of Guadalajara. He is interested in small and embedded devices, OO technologies, evolving algorithms and the Internet.

Armando Morales

Armando Morales graduated as an EE in 1984, he joined IBM in 1985 as a product engineer for S/36 later for AS/400, in 1990 he finished an MBA program, and in 1992 he joined the Guadalajara Programming Lab where he has been a team leader for multiple software projects for the AS/400, and PSG. He is interested in new applications for embedded systems and small devices such as the IBM Workpad.

Go to Top | Go to TSpaces Home