Re: Parsing generics painfully

Mark Raynsford <[email protected]> Thu, 2 Nov 2017 10:10:21 +0000
Newsgroups gmane.comp.java.objectweb.asm
Organization io7m.com
Message-ID <[email protected]>
On 2017-11-01T18:29:35 +0000
Mark Raynsford <[email protected]> wrote:

> Hello.
> 
> Does anyone have any example code regarding parsing generics into an
> AST-like structure? I'm having extreme difficulty correctly building
> ASTs from the event-based SignatureVisitor, and the lack of
> documentation is really not helpful at all.

To elaborate: What I'm actually trying to do is compare two signatures
to try to determine if the generic type parameters of a given class
have changed. I consider two signatures to be equal if they're
α-equivalent: Take the first signature, substitute the names of all of
the bound variables with unique integers, saving the mappings of names
to integers. Perform the same renaming on the second signature using the
names → integers mapping produced from the first signature. Compare the
two renamed signatures for structural equality.

-- 
Mark Raynsford | http://www.io7m.com
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEgWja4isV0+3HIsI9DxW30G+oDLgFAln67w0ACgkQDxW30G+o
DLhiOw/+JBaSADl4ERJ2Ab8z+Qr374tPwxi+V13+0UixD/24zqVD/C14kL84+x80
Axx+O4IS8c0wdU/RHzgLcKZFHttpxZj+fuDkoG8q3hLM13egu/phH+ZCDJCAlGDW
yNn6cnFbo1sGoF2Grnas5SJ7A4yGhbcAJb4GgW8uo2nSUAXTTCZxR2NPdb3x8hQn
5LlQBNWgsnbLIsLJK5inXgKpXAKW7EAmJFkHFxrch8tpJYoTpQmYGEZEtVhgZETV
pnwI0D+MbFclcaRuuWE7o8Y/wWazcsXIO9eIViBodar5xmC5Jb8vy6CoASP/24bW
0hI8jJOwCEc+yd2EP00UxAajn3Vmg3Ec1IITPudYXJOzZmCQ5PcuhYfB+8+2SOqn
OtWNnZzo4+Ryjohuz8C57PbCiIHrpn43yGiYqy98rPduqKkrtSu7OXPi66MVTaKn
mGhCy78Wyk2ecKqvxEAzHbB8MmXaKWUPOGwOlXb2SSSsK9HY0sgIinuoe9VQ49xO
O6j5DalhUNEe0ItrLiCeF/wpQDg/XNY0jH2IR4zv0K/VzucGtIHuDeRdGgayPJCY
nAe+kEf/87weeFDRMqxRpTHaAI8piJbZinunwjgK1mB1fxfl4GuNiozVyduBViXe
v0X+yoYICA9ojvkyUfKiKSXu1VaYoduXj8sMdEk1byTsF7ISrAA=
=ohzy
-----END PGP SIGNATURE-----