MDDL


next up previous
Next: Dynamic persistent pages
Up: The motivation: economic models on the Weband dynamic
Previous: How to avoid CGI programming

MDDL

 

The solution adopted [Ireson-Paine 1995b] was to take the format analogy literally, extending HTML so that it could be used like a format string. An example of the resulting language, MDDL, is shown below.

The idea is that the modeller, when creating the Web input pages for a new model, writes them in HTML augmented with placeholders for program variables. The line

Your name? <? name  string  size=20>
corresponds to the standard HTML
Your name? <INPUT TYPE=TEXT NAME="$name" SIZE=20>
When the user submits the form containing this field, the model will start running, and the data entered in this field will go to the variable name in the model. Similarly, data from the second field would go to the age variable. The third line generates a menu of tax rates, sending the user's selected option to the real variable TaxRate. And the fourth is similar, except that the menu options are translated before the program sees them: if the user selects Scrap it!, the program gets 0. Menus generated in this way can be seen on Be Your Own Chancellor and Budget 95.

These MDDL commands can be interspersed with normal HTML. MDDL is implemented by a preprocessor, which reads an MDDL file, and emits three things: an HTML page; a look-up table stored in a file for use by the server; and the text of a Modula routine. Each MDDL command within the input thus also gets translated into three things: the equivalent HTML command; an entry in the look-up table; and a call to an Modula library routine.

Having run the preprocessor, the modeller must place the HTML page in the IFS Web page directory, and must link the generated Modula code with the model, which will call it when it needs to read the user's data.

The HTML page gets sent to the user when he or she asks to start the model. When the server receives data from this page, it uses the look-up table to check its syntax and perform any necessary conversions. It then writes the data into a temporary communication file. When the server has checked and processed all the data, and if the data was all valid, it starts the model, passing it the name of the communication file as a parameter. The model then reads from this file, calling the generated Modula routine to do so, and then - we hope - runs to completion. It may write data back to an output file, which is then transformed into an HTML page by the reverse of this process.

As an example, the MDDL line

<? VATChange integer options="Scrap it!:0/Double it!:2">
would generate:


next up previous
Next: Dynamic persistent pages
Up: The motivation: economic models on the Weband dynamic
Previous: How to avoid CGI programming



Jocelyn Ireson-Paine
Sat Oct 12 23:35:52 BST 1996