Better Reading

Pages

Sunday, June 2, 2013

易语言, a Chinese-lexified programming language

I just found out about Yìyǔyán (易语言, a.k.a. EPL), a Chinese-lexified programming language, which claims to be "The best development environment in China, and the best Chinese programming language".

I've often been curious what it would be like to work with a programming language that was not lexified from English.  I'm tempted to try it out, but first I'd like to take a look at "Teach yourself EPL in Ten Days".

Day 1 looks like an introduction to the IDE.  Here is a simple snippet of code pulled from Day 2:

变量1 = “我爱”
变量2 = “易语言”
变量3 = 变量1 + 变量2
编辑框1.内容 = 到文本 (变量3)

The syntax is generally familiar.  We have assignment (A = B), quoted strings, string concatenation with the plus sign (A + B), dot-notation for accessing object members (A.B) and parentheses to enclose function call parameters (A(B)). We can translate this snippet as follows:

variable1 = "I love" 
variable2 = "EPL" 
variable3 = variable1 + variable2 
textbox1.content = tostring(variable3)

There are several things that are incredibly interesting about this.  First, the act of translating the code from EPL to...whatever Englishy thing I translated it into...isn't a mechanical act.  There is real interpretation going on here, just as there is in translating natural language.

Translating 变量 as "variable" is no big deal, and translating the content of the strings ("I love" + "EPL") is also no big deal.  But rendering 编辑框 as "textbox" is a matter of interpretation.  Is the EPL 编辑框 the same thing as a textbox in the languages I am familiar with?  The "Textbox" I know and love in C# has a Text attribute, but the 编辑框 has a 内容 attribute.

There is something else here, too, that is really interesting.  In line 3, variable3 appears to be a concatenation of variable1 and variable2.  Normally you would expect that the result of the concatenation would be a string (文本), but then why would it need to be cast into a string (到文本) before being assigned to the content of the textbox?

One possible reason is that, when you concatenate strings in EPL, you create lists.  We'll have to keep an eye out.

This is cool!


No comments:

Post a Comment