implementation of ast