Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • The BNF exists only to tell you what the syntax is. The semantics determine what is actually done, given that the language presented is accurate.

    So your BNF should specify a leading number, the dots, the comment, the newline. This allows a lexer to read the language and say "yes, that is a valid line of TAP" or "no, it's not valid because ...".

    Take this example:

      <value> := <value> + <term> | <term>

    So we've defined that a value is one or more terms, separated by '+'. We have not defined what the operation does, but we have defined that
        <term>
        <term>+<term>
        <term>+<term>+<term>+<term>

    are all valid syntactically. It could be concatenation, or addition, or a series of subroutine calls, or whatever else we've decided '+' means.

    so you have a few lines that specify that a test plan is <digits>..<digits><newline>. It's up to the semantics to determine that the first number should be 1, and that the last one should be > 1, and that at the end of the input, all of the numbers between 1 and the second one were found, in ascending order.

    lex and yacc actually confuse the issue because they're not just parsers; they add in sematics too.