It's physics based. Anything can be crafted from anything.
For example if making a sword, there is the blade and the handle. Use different items for construction and you get different results. Put steel in the blade and steel+gold in the handle to get a sword fit for a king (if crafted with enough skill). On the other end of things, put a fish in the blade and a pie in the handle to get a very useless weapon.
This lets crafting have a bit of creativity and work in all situations. A player can be lost in the woods and craft stone tools and a stick shelter for example even though those aren't hard coded for that rare situation.