On 9/14/06, Ovid <[EMAIL PROTECTED]> wrote:
----- Original Message ----
From: jerry gay <[EMAIL PROTECTED]>
> thanks for the responses. i've done a second take on the TAP grammar
> in perl6 format, with the help of patrick michaud. i'm pretty sure
> it's correct now, at least as per your previous grammar. have a look:
I'll update my grammar as I can and I'll send it along and I'll try to
incorporate your work. It's great to see a Perl6 version.
:)
Do Perl6 grammars support semantics along with syntax? Each test number should
actually be one greater than the previous test number, but a traditional EBNF
can't support that.
yes, they do support semantics (via closures.) you can keep a state
variable around that lets you know the last test's number. it can be
done in perl6 or parrot by writing a custom rule, since rules and subs
are the same thing. i wouldn't do that in the parser, though, it has a
bad code smell to me. i think it would better go in a semantic
analyser.
~ there are some places i took liberties (eg. \d versus [:digit:], \N
> verses [:print:] (are comments, directives, and description really
> limited to printable characters?).)
Hmm, never thought about that. I don't think there's anything really wrong
with non-printable characters (are null bytes a problem?), but I'm not sure how
to represent that.
it can be represented in perl6 quite easily: C<< <+print & \N> >> is
one way, but i don't think there's trouble in non-printables in tap
comments.
> as an aside, patrick asked why C<1..0> was valid. i explained
> C<no_plan>, and he asked why it wasn't C<1..> or the more perl6ish
> C<1..*>. i know TAP isn't perl-only, but i have to say, C<1..*> is
> really growing on me... 'one to whatever.' it looks and sounds better
> than 'one to zero.' anyone else have thoughts on that?
'1..0' actually means 'skip all'. '1..' or '1..*' would be useful for
indicating an infinite stream. 'no_plan' TAP has the plan at the end.
silly me, i knew that. thanks for the reminder.
~jerry