Handle nested templates

In real codes, we will encounter nested template cases. That is there
are template instance in template instance like:

type(list_t<data_t<integer>>) …
            ^^^^^^^^^^^^^^ nested template instance in code

or template instance in template definition like:

type, extends(list_elem_t<#{instance}>) :: #{instance} …
              ^^^^^^^^^^^^^^^^^^^^^^^^ nested template instance in
                                       template definition