Perl: the Markov chain saw | |
PerlMonks |
Re^4: Perl not BNF-able??by ikegami (Patriarch) |
on Jul 05, 2005 at 15:02 UTC ( [id://472478]=note: print w/replies, xml ) | Need Help?? |
BNF dictates syntax, and the above snippet is syntactically correct. perl -c agrees by saying "syntax OK". The following is syntactically correct C++:
Are Type1* and Type2* assignment compatible? It doesn't matter as far as BNF is concerned because it only specifies the syntax. The error in your Perl snippet and the error in the above C++ snippet (if any) are semantic errors. Semantic analysis is usually done independant of parsing. Semantic analysis checks things such as types, and whether forward declerations have been resolved. These are things that don't affect the compiler's understanding of the code, but affect whether the code is consistent (valid) when looking at the bigger picture. BNF does not have a role in semantic analysis. BNF is therefore sufficient to handle the Perl in your post.
In Section
Seekers of Perl Wisdom
|
|