refactor the code completely, add visitor pattern

visitor pattern, interpreter pattern, etc