2 votes 2 votes printf("Hello); In the statement given above,is there any lexical error or not ? Compiler Design compiler-design lexical-analysis descriptive + – Purvi Agrawal asked Mar 10, 2017 • retagged Jun 21, 2022 by Lakshman Bhaiya Purvi Agrawal 1.2k views answer comment Share Follow See 1 comment See all 1 1 comment reply utk0203 commented Mar 10, 2017 reply Follow Share But "Hello -> is not a valid token? 0 votes 0 votes Please log in or register to add a comment.
4 votes 4 votes Yes, there is a lexical error. "Hello); is NOT a valid string literal. nadeshseen answered Sep 4, 2019 nadeshseen comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes The above statement has no Lexical error. If you think about a lexer as a finite state machine that accepts valid input strings, then errors are going to be any input strings that do not result in that finite state machine reaching an accepting state. vishwa ratna answered Mar 10, 2017 vishwa ratna comment Share Follow See all 7 Comments See all 7 7 Comments reply Show 4 previous comments set2018 commented Oct 7, 2017 reply Follow Share Venkat Sai it means it is not a valid token thts why lexical error 1 votes 1 votes Venkat Sai commented Oct 7, 2017 reply Follow Share yeah its not a valid token and hence a lexical error as this continues till the end of the program is considered as the same literal as there is no closing " and this cannot be tokenised 1 votes 1 votes Purvi Agrawal commented Oct 7, 2017 reply Follow Share Okay..Thanku 0 votes 0 votes Please log in or register to add a comment.