A grindstone repairs tools/weapons at the cost of any enchantments on the tool/weapon being discarded. An anvil allows you to repair you tool/weapon without discarding those enchantments.