User:Jan Hidders/Wikipedia syntax

This is an attempt at a formal grammar in EBNF that can be used to describe and discuss the semantics of the contents of pages in Wikipedia. Note that it does not attempt to describe what is accepted because everything is in fact accepted. What it does try to do is define an unambiguous syntax tree that is detailed enough to describe how the parser transforms it to HTML. Where the syntax is not unambiguous we will presume that the parser processes it as Yacc would do.

Strings will be quoted with ' (single quote) or " (double quote). The single quote means a literal quote and the double quote means a quote modulo an upper/lowercase conversion. For example "ab" matches the strings 'ab', 'Ab', 'aB' and 'AB'.

 <content> ::= <redirect> | <article>
 <redirect> ::= "#redirect[[" <title> ']]'

Note: What should probably also be taken into account: (1) Whitespace around the full title (2) extra whitespace or remarks after the closing brackets.

 <title> ::= [ <wiki code> ':'] [ <namespace> ':' ] <subject>

Note: the square brackets denote optional parts.

 <wiki code> ::= "w"| "m" | "simple" | "aa"| ... | "zu"

Note: The last part are the ISO 639 2-letter language codes

 <namespace> ::= "special" | "talk" | "user" | "user_talk" |
                 "wikipedia" | "wikipedia_talk" | "image" | "image_talk"
 <subject> ::= <subject char>+

Note: the '+' is the repeat-one-or-more-times operator.

 <subject char> ::=  ' ' | '!' | '%' | '&' | '"' | '(' | ')' |
                     ',' | '-' | '.' | '/' |
                     '0' | ... | '9' | ':' | ';' | '?' |
                     'A' | ... | 'Z' | '_' |
                     'a' | ... | 'z' | xA0 | ... | xFF

Note: The expressions xA0 and xFF denote the hexadecimal notation of these characters.

 <article> ::= <block>* 

Note: the '*' is the repeat-zero-or-more-times operator.

 <block> ::= <nowiki block> | <html block> | <wiki block> | ...
 <nowiki block> ::= '<' <ws>* "nowiki" <ws>* '>' <any char>* '<' <ws>* "/nowiki" <ws>* '>'
 <ws> ::= <space> | <form feed> | <new line> | <car. ret.> | <hor. tab> | <vert. tab>
 <html block> ::= <closed html> | <open html> | <html comment>

Note: With "closed html" I mean HTML that begins with an open tag and a corresponding closing tag, and "open html" consists of a single opening tag.

 <html comment> ::= '<!--' <any char>* '-->'
 <open html> ::= ... "br", "p", "hr", "li", "dt", "dd" ...
Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools