1 votes 1 votes How to differentiate between Lexical, semantic and syntax error from a given code snippet. Why is this lexical error and not syntax error? $ y = 0x5i; $ Compiler Design compiler-design lexical-analysis made-easy-test-series + – Mrityudoot asked Nov 12, 2023 • edited Nov 14, 2023 by Mrityudoot Mrityudoot 245 views answer comment Share Follow See 1 comment See all 1 1 comment reply Hira Thakur commented Dec 7, 2023 reply Follow Share ref here: How is this lexical error 1 votes 1 votes Please log in or register to add a comment.
1 votes 1 votes This number is start with 0 and we know octal no is start with 0 and (0 to 7 numbers are only allowed here) but here x,i written that's why it shown error in Lexical phase. It's not indentifying as Token. Sagar2900 answered Nov 13, 2023 Sagar2900 comment Share Follow See 1 comment See all 1 1 comment reply Mrityudoot commented Nov 14, 2023 reply Follow Share 0x denotes hexadecimal, so the number is not octal. Anyways I have changed variable name to avoid confusion. 0 votes 0 votes Please log in or register to add a comment.