The language is illustrated here by way of a short example.
<lesson><part><omc-question> What color is the sky? <choice>red <wrong>Maybe at sunset <choice>blue <right>Congratulations <choice>green <wrong>Love to visit your planet. <choice>yellow <wrong>Staring at the sun again? </omc-question></part><part><mmc-question> What computers did Seymore Cray design? <choice>CDC 6600 <right>The 6600 is considered one of his landmark designs. <choice>Apple II <wrong>The Apple II was designed by Steve Wozniak. <choice>Cray 1 <right>Who do you think did design the Cray 1? <choice>Cray 2 <right>All of the Cray 1 through 4 series were designed by him. <choice>ENIAC <wrong>Before his time. </mmc-question></part><part><sa-question> What is the name of a CS professional society? <choice>AOL <wrong>Look again <choice>ACM <right>By George, you've got it. </sa-question></part></lesson>
Assuming this code is contained in the file example.httml, it is processed with the command httml example.httml. The translator then creates an index file, example.html and the HTML files example-1-1.html, example-1-2.html and example-1-3.html which contain HTML code for each of the three parts. A fourth HTML file, example-1-4.html is written which announces completion of the lesson and provides a pointer back to the index.
With only minor differences, the output produced by the translator with the Lex back-end is essentially the same as the code that was used in our C tutorial. The CGI code for the questions are written to the files example-1-1.l, example-1-2.l and example-1-3.l, and these files are compiled into the executables example-1-1.cgi, example-1-2.cgi and example-1-3.cgi. For the one-of-many multiple choice question the responses are written to the files example-1-1.wrong1to example-1-1.wrong4. For the many-of-many multiple choice question in Part 2, we have five choices for answers. In general if we have n choices, then there are possible sets of answers the student may give, and we would like to produce a different response for each. Consequently, only the right answer is written to its own file, example-1-2.right in this case. The responses for wrong answers are encoded in the CGI script itself. The short-answer question is structured much like the one-of-many. Here we generate the HTML response files example-1-3.wrong1 and example-1-3.right2. For this case, though, we also have an additional file example-1-3.wrong that is the response for a generic wrong answer that doesn't match any of the choices specified.
For the AppleScript back-end, we generate the same set of HTML files. Instead of the Lex source code, the translator puts the AppleScript directly into the .cgi files