Here is a simple interpreter for beta-reduction of terms, which has been implemented using de Bruijn (de Braun) notation.