This topic is now archived and is closed to further replies.


This topic is 5872 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Original post by Major
A parse error it's when you foret a ' ; ' in the end of an you just have to place the ';' where you forget it.

Not exactly (though you describe one kind of parse error).

A parse error occurs when the succession of tokens does not comply with the expected language syntax. Sound complicated? It's not. Every unique identifier (a, x, myvar, str, etc), operator (+, -, %, [], (), +=, --, /, etc) or keyword (int, long, bool, this, const, static, operator, etc) is regarded as a token by a compiler (my examples are from C/C++; the actual tokens will differ per language). The language specifies an expected syntax that must be followed, along the lines of
statement statement-terminator    
A statement may consist of
keyword-declarator identifier {assignment-operator initializer-value };
(entities within {} pairs are optional)...

and so forth. This defines what the compiler expects on a per-line basis, within parentheses (depending on what keyword/identifier preceded it) and so on. If it does not encounter one of the expected/permitted entities, it signals a parse error.

In other words, a parse error means that you either left something out or you added something that should be there. Occasionally it may be more complicated than that, but that's generally the synopsis.

Oh, and write a topic next time. Be courteous to the people on this forum and help them to help you. Many people who could have answered your question fully may not have sincce you wrote "???????", and if every newbie writes that, then how do we know what is what?

Good luck.

[Edit:] Pre-formatted line termination.

Edited by - Oluseyi on November 18, 2001 3:01:28 PM

Share this post

Link to post
Share on other sites