Student Projects
Dr Peter Coxhead

Contact details

E-mail: p.coxhead@cs.bham.ac.uk
Room 134, but please make an appointment by e-mail.

Project details

Introduction

Behind many Wikipedia pages there are 'templates' which automate the process of creating the same format for content on many pages. The language used in creating templates is far from user-friendly, and results in expressions such as the following:

{{#switch:{{PAGENAMEBASE}}
|{{select genus|{{{genus|}}}|{{{taxon|}}}|{{PAGENAME}}}} {{select species|{{{species|}}}|{{{taxon|}}}|{{PAGENAMEBASE}}}}
|{{select genus|{{{genus|}}}|{{{taxon|}}}|{{PAGENAME}}}}={{Italic title}}}}{{{name|''{{#if:{{select species|{{{species|}}}|{{{taxon|}}}|}}|{{select genus|{{{genus|}}}|{{{taxon|}}}|{{PAGENAME}}}} {{select species|{{{species|}}}|{{{taxon|}}}|}}|{{PAGENAMEBASE}} }}''}}}

(I spent about half a day debugging this expression – which I didn't write – when it wasn't working correctly. The error was caused by a space character intended only to separate two sets of "}}" but which resulted in an extra space in the result of the expression.)

For an example of a template which is very widely used, see:
http://en.wikipedia.org/w/index.php?title=Template:Taxobox/core
(Choose "View source" to see the code.) Almost any article about an organism or group of organisms will include a 'taxobox' generated by this template. See, e.g., http://en.wikipedia.org/wiki/Blue_whale – the box at the top right is a taxobox. As of 12 May 2011, there is known to be an error in the behaviour of this template, for which there is a work-around, but the error has not yet been located so it can't be fixed.

For an introduction to Wikipedia templates, see http://en.wikipedia.org/w/index.php?title=Help:Template.

1. Animated Evaluation

Debugging is greatly helped by being able to use a tool which allows step-by-step evaluation, displaying the results of each step. Construct such a tool for the Wikimedia template language. Ideally, it should be able to be run online in any standard browser.

2. A Compiler/Translator

Debugging is best avoided by being right in the first place. One idea is to develop a language which is equivalent in power to the Wikimedia template language, but is much more user-friendly (perhaps a Java or Javascript like syntax, although the expression language is strictly functional with no variable assignment, so this may not be the best choice). Then expressions written in this language would be compiled or translated into the Wikimedia template language. Ideally, it should be able to be run online in any standard browser.