DragonCompiler
DragonCompiler copied to clipboard
A bug in lexer.c
When I am learning this lecture, I found a bug in lexer.c. This lexer can't distinguish between eg. 0xaa, xaa. The former should be recognized as a hexadecimal token and it works fine. According to C standard,the latter should be recognized as a identifier token, but the lexer treats it as a hexadecimal number in fact. When lexer gets “0xab”, then do pop token 0 skip ‘x' convert "ab" to int
When lexer gets "xab", the program will directly goto case 'x' and treat it as a hexadecimal number. Obviously it's not.