I suppose, now that the main use of BNF is in standards, we've gotten
used to thinking of "A ::= B" as a definition, because that's basically
what amounts to when used in a standard. But that's misleading and
confusing if you're actually parsing, where A ::= B says that, in
constructing a derivation tree, you can add a <B> child below an <A>.
That's very different from defining <A> and <B> to be same.
Grune & Jacobs suggest that "::=" be read as "may be replaced by". I'll
often read it as "produces".
It may be easiest to keep in mind that BNF is a theoretical machine,
just as a Turing machine is, although BNF is less powerful. You can
think of the BNF productions as instructions to a machine, just like the
states of a Turing machine, or assembler instructions.
-- jeffrey
On 06/18/2014 03:56 PM, Ron Savage wrote:
Also on slide 2: The LHS of a production is not really its name,
it's a
symbol. That is, "A ::= B" says that symbol A derives (or
produces or
can be rewritten to) symbol B. "A" is sometimes used to "name" the
rule, to be sure, but it's dangerous to think of it as the rule's
name.
One reason it is dangerous is that several rules can have the same
LHS:
I always say to myself '::=' is read as 'is defined to be'. So here A
::= B reads as A is defined to be B (which in turn must be defined....).
--
You received this message because you are subscribed to the Google
Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "marpa
parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.