sml: implement the core classes for tagging support