Meh, why not just use code generation for this problem?  That&#x27;s what CPython does.<p><a href="http:&#x2F;&#x2F;eli.thegreenplace.net&#x2F;2014&#x2F;06&#x2F;04&#x2F;using-asdl-to-describe-asts-in-compilers" rel="nofollow">http:&#x2F;&#x2F;eli.thegreenplace.net&#x2F;2014&#x2F;06&#x2F;04&#x2F;using-asdl-to-descri...</a><p>To me this [1] looks way better than a bunch of C++ macros.<p>[1] <a href="https:&#x2F;&#x2F;hg.python.org&#x2F;cpython&#x2F;file&#x2F;tip&#x2F;Parser&#x2F;Python.asdl" rel="nofollow">https:&#x2F;&#x2F;hg.python.org&#x2F;cpython&#x2F;file&#x2F;tip&#x2F;Parser&#x2F;Python.asdl</a>