Does Perl use a special hand-made parser, or does it use Yacc or some
am 16.04.2008 21:49:02 von irishhackerDo you know?
Do you know?
Robert
> Do you know?
perlfaq7 may be of interest.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Robert wrote:
> Do you know?
$ perldoc -q yacc
| Can I get a BNF/yacc/RE for the Perl language?
|
| There is no BNF, but you can paw your way through the yacc grammar in
| perly.y in the source distribution if you're particularly brave. The
| grammar relies on very smart tokenizing code, so be prepared to venture
| into toke.c as well.
|
| In the words of Chaim Frenkel: "Perl's grammar can not be reduced to
| BNF. The work of parsing perl is distributed between yacc, the lexer,
| smoke and mirrors."
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
Robert wrote:
> Do you know?
The parser is a fairly standard LALR parser generated using
bison from the perly.y file in the source distribution.
The lexical analyser, OTOH, is a special hand-made lexer.
All the smoke and mirrors used to parse Perl can be found
in the lexer source code in the file toke.c.
-- HansM
On Wed, 16 Apr 2008 12:49:02 -0700, Robert wrote:
> Do you know?
If you compile perl from the source code, the "Configure" script asks you
whether you want to use byacc or bison at one point (maybe it has
detected these first).