3 ms·
I prefer writing scripts to generate repetitive code. The result tends to be quite readable, it can be seen in the debugger, and you have the full power of a s
by makecheck 11y ago
I prefer writing scripts to generate repetitive code. The result tends to be quite readable, it can be seen in the debugger, and you have the full power of a scripting language to build your code.
- munificent 11y agoYeah, when the language isn't flexible enough to let me get rid of boilerplate using its own primitives, I like doing that too. AST classes are a good example of something where a simple script can pound them out. When I was working on Magpie, I did just that. This script[1] generates this file[2]. [1]: https://github.com/munificent/magpie/blob/master/script/generate_ast.py https://github.com/munificent/magpie/blob/master/script/gene... [2]: https://github.com/munificent/magpie/blob/master/src/Syntax/Ast.generated.h https://github.com/munificent/magpie/blob/master/src/Syntax/... I got this trick from Jim Hugunin, of Jython and IronPython fame.