Tags:
create new tag
, view all tags

Question

Does anyone know where to find a Backus-Naur Form (BNF) or Extended BNF for WikiWord? I expect to find a precise grammar of WikiWord

Regards,

Spenser

Environment

TWiki version: TWikiRelease04x00x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Derbian GNU/Linux 3.1
Web server: Apache, version to be found
Perl version: 5.8.4
Client OS: Windows XP version 2002
Web Browser: Firefox 2.0.0.4
Categories: Documentation

-- SpenserKao - 16 Jul 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

There is no BNF documentation, though are invited to contribute one. WikiWords are described at WikiWord. WikiWords are linked automatically of preceeded by whitespace or parenthesis.

-- PeterThoeny - 16 Jul 2007

Thanks Peter, here is the EBNF grammar based on what I reverse-engineered the behavior of creating new topics:

      wikiWord := firstWord restWord*
      firstWord := upperLetter (upperLetter | lowerLetter)*
      restWord := upperLetter (upperLetter | lowerLetter | number)* 
      lowerLetter := a | b | c | ...| z
      upperLetter := A | B | C |...| Z
      number := 0 | 1 | 2 |...| 9

-- SpenserKao - 17 Jul 2007

That grammar define as WikiWords things like U and UU, which is not right.

I think is more like this:

      wikiWord := firstWord restWord+
      firstWord := upperLetter+ (lowerLetter | number)+
      restWord := upperLetter (upperLetter | lowerLetter | number)* 
      lowerLetter := a | b | c | ...| z
      upperLetter := A | B | C |...| Z
      number := 0 | 1 | 2 |...| 9

Let´s see (U stands for Upper Case, l for lower case, 1 for number):

UlU UUlU UllU U1U U11U UUllU UiU1 UiUl UiUU

-- RafaelAlvarez - 17 Jul 2007

After consulting Extended Backus–Naur form I think this one is the correct syntax.

    wikiWord        = upperLetters , lowerNumLetters , upperLetters , { alphaNum } ;
    upperLetters    = upperCase , { upperCase } ;
    lowerNumLetters = lowerNum , { lowerNum } ;
    alphaNum        = upperCase | lowerCase | digit ;
    lowerNum        = lowerCase | digit ;
    lowerCase       = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i"
                    | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r"
                    | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ;
    upperCase       = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I"
                    | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R"
                    | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" ;
    digit           = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;

WikiWord is updated.

-- PeterThoeny - 18 Jul 2007

That's a more formal definition. Thanks smile

-- RafaelAlvarez - 18 Jul 2007

With 4.2, I'm encountering words that did not use to be wiki words and that do not fit the BNR in WikiWord. Such as

I1CONSUM

I1CONSUM2

-- JerreCope - 15 May 2008

A recent TWiki version changed the WikiWord spec by considering digits as lower alphanums, which caused issues you describe.

-- PeterThoeny - 23 Jul 2008

 
Change status to:
Topic revision: r8 - 2008-07-23 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.