Software-Defined Reconfigurable Intelligent Surfaces: From Theory to End-to-End Implementation