SUSE developers propose to replace AWK with Python in the GCC compiler
A few days ago, a SUSE developer sent an email to the GCC development team hoping to allow a scripting language (Python) to be used in the GCC compiler codebase, primarily to replace the existing AWK language.
The SUSE developer Martin Liška is currently looking for possibilities for this proposal. He said that this is not to replace the existing GCC C compiler code with a scripting language or something like that, but to replace the current hard-to-maintain AWK scripting language.
Martin Liška believes that the AWK code in GCC is now “very unpleasant for making any adjustments”, so Martin is observing whether there are enough upstream developers who prefer to allow Python to replace it. The proposal may be the responsibility of the GCC Steering Committee.
Some questions about AWK mentioned by Martin
1) gcc/optc-save-gen.awk is full of copy&pasted code, due to lack of flags type classes multiple global variables are created (var_opt_char, var_opt_string, …)
2) similar happens in gcc/opth-gen.awk
3) we do very many regex matches (mainly in gcc/opt-functions.awk), I believe we should come up with a structured option format that will make parsing and processing much simpler.
4) we can come up with new sanity checks of options:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=813975) there are various targets that generate *.opt files, one example is ARM:
gcc/config/arm/parsecpu.awk
The proposal can be found on the GCC mailing list.