Parsing Perl 2: Down the Garden Path
The Garden Path
In Perl 5.10, the following code is a syntax error:
{42;{1,2,3;4}}
If you try it,
what you'll see
is something like this:
syntax error at (eval 25) line 1, near ";4"
syntax error at (eval 25) line 1, near "}}
TPP is based on an algorithm called LALR. (To avoid confusion when discussing various programs which parse Perl, I will call the one that comes with the Perl distribution the Tradition Perl Parser, or TPP.) If you look at perly.y, you will find a real achievement in LALR parsing. and therefore in computer language parsing in general. But LALR has its limits and even in the TPP these show up every now and then.
