<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 22, 2017, at 14:15, Hal Finkel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">For situations well beyond TableGen's current language capabilities, we have a decision to make. We can continue extending TableGen until it can meet those needs. Alternatively, we can enable the use of some more-powerful input language. For example, we could allow TableGen to embed Python, and then use Python in order to generate record definitions.</span></div></blockquote></div><br class=""><div class="">For a project that’s not LLVM, I recently had the opportunity to replace both TableGen and *.td files with Python scripts. I found that TableGen’s features were easily matched by Python’s for loops and the ability to define functions. I am pretty happy with the approach so far. AMA</div><div class=""><br class=""></div><div class="">This is a lot easier to do in a green field project than in an old project like LLVM, of course.</div><div class=""><br class=""></div><div class="">Example “.td” file: <a href="https://github.com/stoklund/cretonne/blob/master/lib/cretonne/meta/isa/riscv/encodings.py" class="">https://github.com/stoklund/cretonne/blob/master/lib/cretonne/meta/isa/riscv/encodings.py</a></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">/jakob</div></body></html>