develooper Front page | | Postings from April 2006

Rought Outline of EBNF Grammar

April 19, 2006 13:20
Rought Outline of EBNF Grammar
Message ID:
Based on what I've gleaned from,
here's a first pass at an EBNF grammar for TAP.  Note that it's
incomplete, but it should be a good start for folks to at least think
about this.


    For the time being, I'm cheating on the EBNF by allowing 
    certain terms to be defined by POSIX character classes by
    using the following syntax:

      digit ::= [:digit:];

    As far as I am away, that's not valid EBNF.  Sue me.  I
    didn't know how to write "char" otherwise (Unicode issues).  
    Suggestions welcome.

(* POSIX character classes and other terminals *)

digit          ::= [:digit:];
character      ::= [:print:];
positiveNumber ::= (digit - '0') {digit};

(* And on to the real grammar ... *)

(* "plan => $num" versus "no_plan" *)

tap    ::= plan tests | tests plan;

plan   ::= '1..' positiveNumber;

(* Gotta have at least one test *)

tests  ::= test {test};

    The "positiveNumber" is the test number and should 
    always be one greater than the previous test number.
test   ::= status (positiveNumber description)? directive;

status ::= 'not '? 'ok ';

    Description must not begin with a digit or contain a 
    hash mark.

description ::= (character - (digit '#')) {character - '#'};

directive   ::= ??? Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About