  Quantum information protocols require various types of entanglement, such as
Einstein-Podolsky-Rosen (EPR), Greenberger-Horne-Zeilinger (GHZ), and cluster
states. In optics, on-demand preparation of these states has been realized by
squeezed light sources, but such experiments require different optical circuits
for different entangled states, thus lacking versatility. Here we demonstrate
an on-demand entanglement synthesizer which programmably generates all these
entangled states from a single squeezed light source. This is achieved by
developing a loop-based circuit which is dynamically controllable at nanosecond
timescale. We verify the generation of 5 different small-scale entangled states
as well as a large-scale cluster state containing more than 1000 modes without
changing the optical circuit itself. Moreover, this circuit enables storage and
release of one part of the generated entangled state, thus working as a quantum
memory. This programmable loop-based circuit should open a way for a more
general entanglement synthesizer and a scalable quantum processor.
