A man on a sidewalk is playing the accordion while happy people pass by.
A man performs for the public
The man performs by playing the accordion.
A man performs on a sidewalk in public for happy people.
A man performs (playing the accordion), and this is for the public since the man performing while happy people pass by.