in reply to Perl not BNF-able??
isn't context-free (assuming the programmer is free to pick the subroutine names, and the grammer isn't going to list all possible subroutine names), and hence certainly not BNF-able.sub hello(); sub hello() {print "world"}
Not even a much simpler (with respect to the language's grammar) language like C is context-free, for the same reason: forward declarations. In general, anything you have a language construct where you're forced to repeat something that wasn't matched by a terminal in the grammar (kind of like using \1 in a regex) your grammar isn't context-free - and hence, BNF will not be powerful enough.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl not BNF-able??
by ikegami (Patriarch) on Jul 04, 2005 at 20:12 UTC | |
by Anonymous Monk on Jul 05, 2005 at 09:00 UTC | |
by ikegami (Patriarch) on Jul 05, 2005 at 15:02 UTC | |
|
Re^2: Perl not BNF-able??
by anonymized user 468275 (Curate) on Jul 04, 2005 at 13:57 UTC | |
by Anonymous Monk on Jul 04, 2005 at 16:03 UTC |