Algebraically, automatic differentiation is the same as adding a nilpotent element e, such that e^2=0 to your algebra.  You can continue this pattern out to get higher order derivatives.  For example, if you also add an element f where f^3=0, the coefficient of f is proportional to the second derivative.