Polybolos

The polybolos (the name means "multi-thrower" in Greek) was an ancient Greek repeating ballista - reputedly invented by Dionysius of Alexandria (a 3rd-century BC Greek engineer at the Rhodes arsenal,) and used in antiquity. 
Philo of Byzantium ( 280 BC – 220 BC) encountered and described a weapon similar to the polybolos, a catapult that - like a modern machine gun - could fire again and again without a need for manual reloading. Philo left a detailed description of the gears that powered its chain drive (the oldest known application of such a mechanism) and that placed bolt after bolt into its firing slot.
Design.
The polybolos would have differed from an ordinary ballista in that it had a wooden hopper magazine, capable of holding several dozen bolts, that was positioned over the mensa (the cradle that holds the bolt prior to firing). The mechanism is unique in that it is driven by a flat-link chain connected to a windlass. The mensa itself was a sliding plank (similar to that on the gastraphetes) containing the claw latches used to pull back the drawstring and was attached to the chain link. When loading a new bolt and spanning the drawstring, the windlass is rotated counterclockwise by an operator standing on the left side of the weapon; this drives the mensa forward towards the bow string. At the very front, a metal lug at the front trigger the latching claws into catching the drawstring. 
Once the string is held firm by the trigger mechanism, the windlass is then rotated clockwise; pulling the mensa back and drawing the bow string with it. At the same time, a round wooden pole in the bottom of the magazine is rotated via a spiral groove being driven by a rivet attached to the sliding mensa; dropping a single bolt from a carved notch in the rotating pole. With the drawstring pulled back and a bolt loaded on the mensa, the polybolos is ready to be fired. As the windlass is rotated further back to the very back end, the claws on the mensa meets another lug like the one that pushed the claws into catching the string. This one causes the claws to disengage the drawstring and automatically fires the loaded bolt. Upon the bolt being fired, the process is repeated. The repetition provides the weapon's name, in Greek , "throwing many missiles", from (), "multiple, many" and () "thrower", in turn from (), "to throw, to hurl", literally a repeating weapon.
Replicas in popular culture.
In 2010 a Mythbusters episode was dedicated to building and testing a replica by the crew of MythBusters, who concluded that its existence as a historical weapon was plausible. However, the machine MythBusters built was prone to breakdowns that had to be fixed multiple times.