Canonical treatment of two dimensional gravity as an anomalous gauge theory