There are *two* sets of laws you need to be aware of here.
The first is Federal law. Under Federal law, a "rifle" is any (rifled) firearm manufactured so that it is intended to be fired from the shoulder. Under Federal law a rifle *must* have a minimum barrel length of 16" and the overall length of the rifle must be at least 26."
The exception is something called a "Short Barreled Rifle" or SBR. A SBR may have a barrel less then 16" in length. The manufacturer of a SBR must first apply for a special "tax stamp" to manufacture a SBR and must pay a $200 tax for every SBR they make. Every time that SBR is transfered to a new individual, another $200 "transfer tax" is paid. (I'm not sure if a SBR has to have a minimum overall length. I don't think it does, but I could be wrong).
A "pistol" is any (non smooth bore) firearm intended to be fired by being held in the hands. Pistols can have any length barrel. Pistols can NOT have a shoulder stock because the addition of a shoulder stock to a pistol creates a "Short Barrelled Rifle." (There are a few exceptions for C&R pistols, but let's not go there now).
Any firearm that is manufactured as a rifle must keep that 16" barrel length and 26" overall length, unless approval is granted to convert it into a SBR and the appropriate tax is paid. That is why you can't just buy a rifle and saw off the barrel to make the barrel shorter or saw off the stock to turn it into a pistol. The only legal way to do it is to pay the $200 tax and apply for the tax stamp.
If the receiver was manufactured to be a "rifle," even if it was never assembled, it is legally a "rifle" and can not be built up into "pistol" configuration. If the receiver was manufactured to be a "pistol," like the AR and AK pistols common now, then it can be built up as a pistol.
Additionally, it *is* legal to add a buttstock to a pistol to make it into a rifle AS LONG AS you also change the barrel so the barrel is at least 16" long. There are conversion kits for the 1911 and Glock pistols that turn them into rifles. (If you used one of those kits, but kept the original pistol barrel instead of using the 16" barrel, you would be violating the law by manufacturing a SBR).
You also have to be aware of your own STATE law. Although SBR's are legal under Federal law, not all states allow them under state law. If your state does not allow SBR's, you can't have one, even though they are legal under Federal law.
That's a simplified version of the basics. As I mentioned earlier, there are exceptions that allow C&R pistols that originally had shoulder stocks to be legal with a shoulder stock, but those exceptions are pretty narrow.
There's also another cateogry called "Any Other Weapon" or AOW. These include things like Pen Guns, and pistols with a vertical foregrip.