Markup spec/BNF

This is an attempt to describe the MediaWiki markup in Backus-Naur form. This may or may not be possible. Any help would be greatly appreciated. The initial aim is to define the MediaWiki parser as it currently works. Improvements and tweaks may well be made to the parser based on shortcomings or ambiguities we discover, but suggestions for changes should be included separately from the current definitions rather than in their place. If and when these changes are incorporated into MediaWiki, the definitions will be updated to reflect this.

About the definitions
The definitions are in Backus-Naur form for the moment. We may find the need to use the extended form (EBNF) to stop things getting too complicated (though it should be noted that EBNF expressions can always be written as BNF).

In general, when parsing a page using this grammar, the matching should be a top-down non-greedy match. i.e. it will always try earlier rules before later ones (always starting from a single point;  in the case of wiki pages) but take the minimum characters to satisfy the complete rule. Exceptions to this should be noted (and avoided if possible).

Bear in mind that these are translation rules, which will be used to convert from one format to another (e.g. wiki-text to HTML), so the grammar may need to include elements that are technically redundant so that they can be referenced in the conversion rules.

All terminals (literal strings) are case-insensitive unless mentioned otherwise.

The basics
These pages describe basic elements that are used throughout the description, and which are fairly generic.


 * /Fundamental elements/

Wiki pages
This is the basic high-level structure of a wiki-page. Follow the links for the details. This section is incredibly incomplete at the moment.


 * 
 * 
 * 
 * /Links/
 * /Magic links/ (e.g. RFC, ISBN, etc.)
 * &lt;nowiki&gt;

Other data formats
The following types of data are external to the wiki page (e.g. the Article's title).


 * /Article title/