Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

what are lexical errors? and fi(a==b) will it be a lexical error or a syntactical error?

OpenStudy (anonymous):

I haven't heard of lexical error, it's only syntactic, semantic, run time and logical. So it would be syntactic error (I think). However when compiler analyses code it does lexical analysis but it just build up "words" from characters but it doesn't check for any errors

OpenStudy (anonymous):

by lexical error i mean to say that whether that error is identified at the lexcial analysis stage or at the syntactic analysis phase

OpenStudy (anonymous):

at lexical analysis phase it doesn't detect any errors it just build up words, brackets and etc and then during other analysis errors are detected, so fi would be detected at syntactic analysis phase

OpenStudy (farmdawgnation):

I would suspect that lexical errors would only really apply if you were using lex/yacc to create your own programming language. In which case, you could have a lexical error in your language grammar or something...

OpenStudy (anonymous):

As a matter of fact, there do exist lexical errors. Every compiler does have a lexical analysis stage. But since lexical analyzers dont analyze the syntax or the structure of the statements, lexical errors are really limited. In the code that you have posted fi(a==b), the tokens are fi, (, a, ==, b. Now we know that instead of "fi", it should have been an "if". But for a lexical analyzer, "fi" is a valid identifier and hence not a lexical error. It shall be detected during the parser or the syntax analysis phase.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!