An Attempt to Modify GCC Source Code on Windows Platform to Another Language!

Related source code documentation:An Attempt to Modify GCC Source Code on Windows Platform to Another Language!File path:An Attempt to Modify GCC Source Code on Windows Platform to Another Language!In the GCC directory, these three files:

  • c-common.h
  • c-common.c
  • c-parser.c
  1. First, change the basic type int to zheng:

An Attempt to Modify GCC Source Code on Windows Platform to Another Language! Figure 1.1

  1. Add RID_ZHENG after RID_INT in c-common.h, as shown in Figure 1.1.

An Attempt to Modify GCC Source Code on Windows Platform to Another Language! Figure 1.2b. Then in c-common.c, add the following line after record_builtin_type (RID_INT, NULL, integer_type_node);:

record_builtin_type (RID_ZHENG, NULL, integer_type_node);

c. In c-parser.c, search for RID_INT, then add the following line after { “int”, RID_INT, 0 },:{ “zheng”, RID_ZHENG, 0 },

An Attempt to Modify GCC Source Code on Windows Platform to Another Language!

Add the following line after case RID_INT::case RID_ZHENG:.

An Attempt to Modify GCC Source Code on Windows Platform to Another Language!

d. Then run the command make CFLAGS=-O2 LDFLAGS=-s to compile and make install to install;

e. Then write a ceShi.c:

An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!

Thus, changing the basic type int to zheng is successful!

2. Then change the control keywords if and else to ruguo and fouze: a. In c-common.h, search for RID_IF and RID_ELSE and add RID_RUGUO and RID_FOUZE after them,An Attempt to Modify GCC Source Code on Windows Platform to Another Language!b. In c-parser.c, search for RID_IF and RID_ELSE, and modify them as follows:An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!c. Then run the command make CFLAGS=-O2 LDFLAGS=-s to compile and make install to install;d. Write ceShi.c:An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!An Attempt to Modify GCC Source Code on Windows Platform to Another Language!Thus, changing the control keywords if and else to ruguo and fouze is successful!

Leave a Comment