FLEX lexical analyzer issue
Posted on 2011-10-27
I am doing an assignment with Flex and Visual Studio 2008.
The analyzer should recognize Integers and Octals. Octals should start with backslash \ and should not occupy more than one byte in the memory. For that, I think octal values should be between 0 and 377 (which corresponds to 255 in decimal).
I have written these pattern definitions in the FLEX scanner file:
When I input 3422, it prints INTEGER
When I input \324, it prints OCTAL
The problem, when I input \567, it prints \INTEGER, while it should print ERROR
Another problem, when I input 12 (doesn't start with backslash) it prints (OCTAL), while it should print INTEGER
Any help solving this?