How can I be able to write C code with different command names instead of the existing, and also to get different compiling warning, errors etc?
For example, replace the 'while' loop declaration with 'foobar', so that:
foobar (i<10) i++;
will act as:
while (i<10) i++;
and to replace a compilation error message from:
prog.c:4:2: error: 'i' undeclared
to:
prog.c:4:2: banana kiwi: 'i' orange apple tomato
A use case for this is making C based on a human-language other than english.
For the input language, you can use macros to define alternate names for things.
Or better to use
typedeffor types.Neither of these removes
intfrom the namespace.If the compiler is made using a grammar file and a compiler-compiler, then you may be able to edit the keywords in the grammar to change the names without introducing new names. This will be the .yacc or .bison or .antlr or sthg file.
For the error messages, those are going to be baked-in to the compiler or in a strings or config file. You'll have to edit those files, or better copy into new locale-variant and modify.
Or run the compiler with a filter that replaces
errorwithbanana kiwi. sed, awk, m4 -- many common tools for substitutions.