Start replacing tons with grams in correct code (5)
I believe the answer is:
debug
'correct code' is the definition.
'debug' can be an answer for 'correct' (debugging is a kind of correcting). I am unsure of the 'code' bit.
I don't understand how the rest of the clue works.
Can you help me to learn more?
(Other definitions for debug that I've seen before include "Remove errors from a computer program" , "Fix (program) errors" , "Fix computer program problems" , "Revise programme" , "Remove (software) errors" .)