Based on what I've gleaned from
http://search.cpan.org/~petdance/Test-Harness-2.56/lib/Test/Harness/TAP.pod#Diagnostics,
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.

Cheers,
Ovid

(* 
    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   ::= ???

Reply via email to