在哪里可以找到Perl编程语言的正式语法?

前端之家收集整理的这篇文章主要介绍了在哪里可以找到Perl编程语言的正式语法?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道Perl语法是模糊的,它的消歧是不平凡的( sometimes involving execution of code during the compile phase)。无论Perl是否具有正式语法(虽然含糊不清和/或上下文相关)? @H_502_2@

解决方法

从 @L_502_1@

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.”

为了看到精彩的例子,为什么由于上下文的影响,几乎不可能解析Perl,请查看Randal Schwartz’s post: On Parsing Perl

另外,请参阅Simon Cozens的“Perl 5 Internals (Chapter 5. The Lexer and the Parser)”中的讨论。

请注意0​​7003

>有a grammar for Perl6
> Rakudo Perl有its own version of the grammar

@H_502_2@ @H_502_2@ 原文链接:https://www.f2er.com/Perl/172950.html

猜你在找的Perl相关文章