Where can I find a formal grammar for the Perl programming language?

前端 未结 3 1282
春和景丽
春和景丽 2021-02-12 21:23

I understand that the Perl syntax is ambiguous and that its disambiguation is non-trivial (sometimes involving execution of code during the compile phase). Regardless, does Perl

3条回答
  •  执笔经年
    2021-02-12 21:48

    There is no formal grammar in the sense "this is the specification of Perl 5" (The Perl 6 effort is trying to fix that, though). But there is a formal grammar in the Perl 5 source code. Of course, understanding the code is most likely not a trivial undertaking.

    Jeffrey Kegler has written some good articles about the perl grammar as well on his blog. In particular see, this post and this one. The rest of the blog has some quite interesting thoughts on parsing in general as well.

提交回复
热议问题