BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Programming In Non-English Languages - BabylScript

Programming In Non-English Languages - BabylScript

English dominates programming languages today; projects such as BabylScript are efforts to try and make programming more accessible to non-English speakers. We speak to Ming-Yee Iu, the creator of BabylScript.

InfoQ: What inspired you to work on something like this?

Ming-Yee: As a hobby, I run a website for teaching programming to kids. I wanted to translate it into other languages for many years, but one issue kept holding me back. I personally learned to program when I was in grade 2 or 3 when I barely understood a single language, let alone two or three. I wanted my website to help modern kids do the same. But if I translated the website into, say, French while still using an English-only programming language, the French version of the site might not be accessible to young kids in the same way that the English version was. So I felt that I needed to put together a programming language that can work in many different languages like French, Spanish, or Chinese for my website. It comes down to a question of access. Computers are becoming a more and more important piece of modern society. They are powerful tools, and people need to know how to program in order to use them fully. But all mainstream programming languages are in English only. This imposes a barrier on non-English speaking countries that makes it harder for them to use computers to the same extent that English-speaking countries can. French kids can't learn to program until they've learnt some English first. A Japanese office worker can't write macros to automate their tasks until they have some background in English first. An Italian web designer can't write JavaScript code for their web pages without knowing English first. In the US, people like Peter Thiel encourage students to drop out of university to create tech start-ups. But in many non-English countries, university drop-outs might not have sufficient English skills to learn programming and create tech start-ups. Sometimes, I wonder whether the US dominates the tech industry because of its spirit of entrepreneurship and its willingness to engage in creative destruction or whether it dominates the tech industry because all mainstream programming languages are in English, and the US is the largest English-speaking country.

InfoQ: How does the translation engine work?

Ming-Yee: Since Babylscript is just a multilingual version of normal JavaScript, the language is already very close to normal JavaScript. Keywords like if, else, and return can be converted directly by the translation engine into English. Names of objects, functions, and other variables are more difficult though. Since JavaScript is a very dynamic language, it is not possible to figure out at compile-time which translations should be used. Keeping with JavaScript's dynamic spirit, Babylscript also supports adding and changing translations at runtime. As a result, the translation engine has to alter variable lookups and object accesses so that they check how names should be translated at runtime.

InfoQ: What would the development setup look like?

Ming-Yee: Basically, the translation engine is a simple compiler that compiles multilingual JavaScript code into JavaScript. It's like CoffeeScript. You write multilingual JavaScript code, give it to the compiler, and it will be translated into regular JavaScript code that you can include on a web page. Since Babylscript is built on Mozilla's Rhino JavaScript engine for Java, Babylscript can also be used as a scripting engine for Java, much in the same way that Rhino is used now.

InfoQ: How complete is the implementation, in terms of functionality available in non-English languages?

Ming-Yee: Translations for the core JavaScript libraries are available for many languages. Unfortunately, we don't have translations for the DOM APIs currently. The DOM is still accessible, but using the standard English API. And since Babylscript is a variant of JavaScript, it also inherits JavaScript's poor support for international date and number formats.

InfoQ: You mention dates and numbers are not yet implemented in non-English variants - in fact numbers get converted to their English counterparts even when you use the non-English numbers! Could you elaborate more on the challenges faced here?

Ming-Yee: Babylscript does allow code to contain numbers written in non-English number formats. The problem is that the JavaScript standard libraries currently only support displaying and parsing US-style numbers. So programmers need to write their own code to display numbers using commas as a decimal mark, for example. Some JavaScript programs even send numbers back to a server in order to format them correctly for different countries! Fortunately, there are now JavaScript libraries for doing this sort of internationalization, and work is being done on adding better internationalization to standard JavaScript.

InfoQ: Have you done any benchmarking for the compiled Javascript code (vs writing it directly in Javascript, for e.g.)?

Ming-Yee: I've played around a little bit, and the performance is poor. Current JavaScript engines aren't really designed to handle the access patterns of Babylscript code, with its repeated lookups of translation tables.

InfoQ: Do you expect significant programs to be written in Babylscript, or is the target more of entry-level programmers who may not be familiar with English (such as non-professional programmers trying a few programming tasks)?

Ming-Yee: Well, Babylscript is currently more of a proof-of-concept that demonstrates how a multilingual programming language might work and to encourage language designers to put such features into their own programming languages. I think multilingual programming languages like Babylscript would be great in educational settings or as macro languages for non-programmers. In reality though, English so completely dominates the programming landscape currently that I don't think it's really viable for professional programmers to write large programs in non-English programming languages.

InfoQ: How has the feedback been from the non-English community so far?

Ming-Yee: I haven't promoted Babylscript much, but the feedback I have received so far has been split. Some people are deeply intrigued by the idea while others feel that it would be better if everyone simply learns English.

Rate this Article

Adoption
Style

BT