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
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
What Ziggy said (Score:1)
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>
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.
Reply to This