The most popular sort of nail gun is the pneumatic nailer. In these machines, the hammering force comes from compressed air, typically generated by a separate gas-powered air compressor. A standard air compressor works on the same principle as a water pump. It has one or more piston cylinders, which draw air in from the atmosphere on the upstroke and push it out to the gun on the down stroke. This generates a constant supply of compressed air, which flows through a hose into the gun's air reservoir.
A pneumatic nailer uses the same sort of hammer as a solenoid nailer: It has a sliding piston that drives a long blade. When the air pressure above the piston head is greater than below it, the piston is forced downward. When the air pressure below the piston is greater than above it, the piston stays up. The trigger mechanism serves to channel the flow of compressed air to shift this balance. The diagram below shows a typical valve system used in this type of gun: