Experimentally, what categorizes a measurement as corresponding to a certain observable? I want to write a computer program.
The input to the program is:


*

*A description of an experimental device (for instance a Stern-Gerlach apparatus, or a laser and a polarizer)

*What the experimenter will do with the device (e.g., fire an electron, fire a photon)


And the output of the program is a sequence of yes/no answers to the following questions:


*

*Does this experiment correspond to a position measurement?

*Does this experiment correspond to a momentum measurement?

*Does this experiment correspond to an angular momentum measurement?

*Does this experiment correspond to a spin measurement?

*Does this experiment correspond to an energy measurement?


What I want to know is:
What is the algorithm the program uses to determine the result "yes" or "no" to each of the above questions?
Background
Why am I asking such a weird question?  Because I've never gotten a clear understandable answer on what constitutes a measurement type.  Note, I am not asking what constitutes a measurement; I am asking what constitutes the type of measurement.  The answers I get are always hand-wavy and subjective.  But it can't possibly be subjective, because otherwise the experimental results would not match those computed with quantum mechanics, e.g., if I compute the eigenvalues of the wrong observable, the values aren't going to match up with those obtained from experiment.
So to give you a concrete example, suppose I shoot an electron at a flat board.  I can measure the board's recoil to get the momentum of the electron, or I can measure the location the electron struck the board to get its position.  But that's a hand-wavy explanation!  I just "decided" that I'd call the first experiment a momentum measurement because it sounds like one, and similarly I simply decided to call the other one a position measurement.  I want an exact procedure to categorize whether it is a position-determining or momentum-determining experiment.
 A: No such algorithm is known. The natural language description of experimental setups is far too informal to be turned into precise quantum mechanical statements. Therefore, we will in the following suppose that a quantum mechanical description of the measurement apparatus in spe has been provided.

In the von Neumann measurement scheme, it is not subjective what is being measured:
A von Neumann measurement is given by an object to be measured in a state $\lvert \psi \rangle$ and a measurement apparatus whose Hilbert space of states is spanned by orthonormal pointer states $\lvert \phi_i \rangle$, which can be "read off" macroscopically - think of the actual position of a pointer. A measurement setup is given if the time evolution of the combined system of object and apparatus is such that a basis $\lvert \chi_i \rangle$ (not necessarily orthogonal) of the object's space exists such that
$$ \lvert \psi \rangle\otimes \lvert \phi \rangle\mapsto \sum_n c_n \lvert \chi_n \rangle \otimes \lvert \phi_n\rangle$$
even after short timescales and to good approximation. (Note that a general evolution would map to $\sum_{i,j} c_{ij} \lvert \chi_i \rangle \otimes \lvert \psi_j \rangle$) Now, this means that to each $\lvert \phi_n \rangle$ there corresponds a unique state of the measured object $\lvert \chi_n \rangle$, and if we observe the pointer to be in a specific state $\lvert \phi_n \rangle$, we say that we have measured the object to be in the state $\lvert \chi_n \rangle$. If the $\lvert \chi_i \rangle$ are eigenstates of some observable, then we say to have measured the value of that observable.

Now, to take your example: If you "decide" to measure the position where the electron struck, then (it is supposed that) you have constructed an apparatus that appropiately combines with the board to get position states as the $\chi_i$ from above. It might not be that we have a quantum mechanical description for that apparatus, so we can't really prove it, and that's why it is out of reach to construct the algorithm you want - we mostly rely on the idea that, because classical physics emerges from quantum physics, the setups that measure certain properties classically will not fail us quantumly.
A: You have to keep in mind that all physical experiments are merely approximations of idealized experiments. No real setup will actually measure a theoretical quantity. They will only measure a reasonable estimate of the quantity, and the measurement will always be marred by statistical and systematic errors. In addition you have to consider sampling errors, finite aperture and finite number of repetitions and the possibility that the theory which was used to predict the experiment itself is wrong. So when you see something as simple as a Stern-Gerlach experiment in your books, you can be sure that the actual experimental design was significantly more complex and that the physicist who did this experiment spent a long time on understanding their error sources. In a well written experimental paper all of this is captured well enough for another experimental physicist with a background in the particular kind of experiment to assess the quality of the work. Such a physicist will also be able to repeat the experiment or to improve on it. A physicist with a different area of expertise, however, might find it already difficult to repeat the experiment, because he/she may not be familiar with little tricks that are part of this kind of experimental work. 
In short, it's basically impossible to algorithmically derive experiments from theoretical quantities that we would like to measure. It's equally impossible to look at an experiment and to tell what it tries to measure. 
