I have finally added CPP support. It took a bit longer than
anticipated as I didn't understand that I would be getting some extra
output from CPP and because I had to implement a C string parser.
The parser should come in handy for string literals too.
I made the following changes to the version of the compiler in the
CVS:
* Added cpp support
* Modified error/warning message format, added another error routine.
* Added preprocessor directive parsing support.
* Added missing newline to Generating Library output.
* Added C string parsing capabilities
* Made the file/line redirection messages from the preprocessor work.
* Fixed the duplicate memory_type problem.
It should also be noted that doing the parsing for the #pragma
directives is trivial at this point. All the routines are in place
to handle it. I'm quite pleased with the results. Here's a sample
from the new output:
[patearl@patmain anyc]$ ./anyc input.c output.asm
input.h:3: warning: Ignoring #pragma
input.c:4: warning: Ignoring #pragma
input.c:13: warning: Implicit type conversion
input.c:20: error: Assignment to invalid expression
input.c:21: error: invalid lvalue (assignment invalid)
input.c:33: warning: bitwise operator used on signed type
input.c:35: warning: Implicit type conversion
input.c:36: error: Can't mix signed and unsigned types without cast
input.c:36: warning: Implicit type conversion
input.c:38: warning: Implicit type conversion
Generating Library:
.........................................................................................................................................................................
[patearl@patmain anyc]$
Notice the warning from the #included header file. The
multi-file/line error message support is shown here also. A simple
pragma parser can be placed in the section of the code that currently
outputs that "Ignoring" message.
Have a nice day.
Patrick Earl
|