I am thinking of a source-to-source compiler would like to add a keyword to the standard C grammar (say shared). When a pointer is being marked as shared, it is a special one not to be dereferenced directly. Instead, a function call should be made to copy out the value safely.
If all variables were primitive types, a simple C++ program would do the translation for me. However, we have struct and union, and then we have possibilities like struct containing shared pointers, struct containing simple pointers to shared pointers, etc. It sounds a serious type checking like handling the volatile keyword, probably reusing or modifying an existing compiler would be a better option. But I do not know which compiler is easier to start modifying. Do you have any suggestions? By the way, I want to see the translated C code, not the intermediate code. Would it change our choice? Thank you.