[cfe-dev] 经过一些思考,我想,如果clang和llvm能提供多语言支持的话,必定会扩大其影响力.使计算机程序和代码世界变得更多彩更丰富和更多可能性./After some reflection, I think that if clang and llvm can provide multi-language support, it will certainly expand its influence to make computer programs and code the ...

Renato Golin via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 19 02:32:37 PDT 2016


On 19 October 2016 at 09:04, Daniel Marjamäki via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> I don't think anybody is against this for "political" reasons. We don't try to force people to use english. We are only worried about the _technical_ problems you will have rewriting Clang to allow that any language is used.

Indeed, agreed.


> My suggestion is that you write a translator that is executed before Clang.
>
> Source code (I used google translate, I don't know if this is correct):
>
>     如果(价值>三)
>
> Your translator could convert that into:
>
>     if (value > 3)

I don't think that'll work in all cases.

I don't know Chinese well enough to make a guess, but I know that
translating "natural" Portuguese or Italian to English is really hard
to get it right.

As I said earlier, "programming" Portuguese and "programming" English
are similar enough that this would probably work. But I won't guess
the same about Chinese. :)

So, the only way this could work is that the "translate-cpp" program
would make a 1-to-1 relationship between <Lang> and C++, and the
programmers were trained to write code in that way.

Essentially, this would be technically identical to adding a list of
languages to Clang and just changing the identifier names.

This solution wouldn't be "ideal", but it would allow more Chinese
programmers to "translate" English code to Chinese, modify it,
recompile it, and send the patch back in English.

cheers,
--renato



More information about the cfe-dev mailing list