Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Re^3: Perl not BNF-able??
in thread Perl not BNF-able??

BNF dictates syntax, and the above snippet is syntactically correct. perl -c agrees by saying "syntax OK".

The following is syntactically correct C++:

Type1 p; Type2 q; p = q;

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://472478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-24 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found