The last one mentioned is to write Java in Chinese and not as a new language. As a Chinese language, grammar structures that require language to provide keywords are used in Chinese. The simplest thing to do is simply to replace the Java keyword with the Chinese key word. does the existing Java library need to be translated again? such as String, ArrayList, map and other classes. Not necessary, because these can only be used as a languagewrite the code, not the language itself. How to achieve it?
- all keywords are written in Chinese and the syntax is unchanged. Before compiling, use a script to replace all the keywords again. The disadvantage is that the source file changes are explicit, and then open, see is the Java keyword.
- Develop IntelliJ idea plug-in, before compiling the Chinese keyword to replace the Java keyword, open before the Java keyword replaced as a keyword. The disadvantage of this approach is that every IDE has to develop a plug-in.
- Javac the Java compiler, after reading the source file, replace the keyword in memory without changing the source file. Subsequent calls to Javac are passed in in-memory files after they are replaced. So as to meet the demand.
This implementation of the "Chinese programming language", can be upgraded with Java, instant upgrade. What new technology is implemented in Java that can be instantly owned. The workload is small, can be said to be a one-time workload, "revenue is quite large." you can try it if you are interested and have a busy moment. ? ?
Have fun-Implement a Java-based Chinese programming language 2