in Compiler Design edited by
232 views
1 vote
1 vote
  1. How to differentiate between Lexical, semantic and syntax error from a given code snippet.
  2. Why is this lexical error and not syntax error? 
    $ y = 0x5i; $
in Compiler Design edited by
232 views

1 comment

1
1

1 Answer

1 vote
1 vote
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.

1 comment

0x denotes hexadecimal, so the number is not octal. Anyways I have changed variable name to avoid confusion.
0
0

Related questions