-1

I want to make a non-english programming language that is identical to what CoffeeScript is to JavaScript. What I mean is that I don't want to build my own design or syntax. Just want to have a non-english programming language that compiles to JavaScript. I want to follow everything CoffeeScript fellows so I don't really want to make any design decisions.

For example:

This is coffeescript:

number   = 42
opposite = true

number = -42 if opposite

I want my language to be something like:

رقم = 42
عكس = صحيح

رقم = -42 إذا عكس

that get compiled to:

var number, opposite;

number = 42;

opposite = true;

if (opposite) {
  number = -42;
}
Ansd
  • 161
  • 8
  • 2
    Wouldn't it be easier to compile to coffeescript then? – Doval Jun 02 '14 at 22:10
  • @MathewFoscarini what about my title :) – Ansd Jun 02 '14 at 22:16
  • @Doval sounds interesting, would appreciate more explanations. – Ansd Jun 02 '14 at 22:17
  • @Ans that's a good title for a tutorial. Not for a question ;) – Reactgular Jun 02 '14 at 22:17
  • 4
    https://github.com/jashkenas/coffeescript fork and modify... – Reactgular Jun 02 '14 at 22:18
  • @Ans we want to help. First explain what you've already tried. – Reactgular Jun 02 '14 at 22:21
  • @MathewFoscarini please feel free to edit my question the way you feel will make it better. – Ansd Jun 02 '14 at 22:23
  • @Ans The answer is that you need to build a compiler and that is not an easy task. See http://programmers.stackexchange.com/questions/84278/how-do-i-create-my-own-programming-language-and-a-compiler-for-it However, Matthew's suggestion is great, look at what CoffeScript does, and change it. If you find some code that you don't understand, then you can ask a more specific question here – Ruan Mendes Jun 02 '14 at 22:31
  • 1
    @Ans By the way, understand that if you do this, you won't be able to get help from anyone else that doesn't understand Arabic. See http://www.babylscript.com/mappings/ar.html for what you are doing (but in JavaScript) not CoffeScript – Ruan Mendes Jun 02 '14 at 22:33
  • @Ans I've never had to do anything of this sort but if your goal is to literally have a copy of CoffeeScript except the syntax is in a foreign language, you don't really have to implement a new language per se...As Robert Harvey mentioned, you just need to translate your code written in the new syntax to the equivalent CoffeeScript code. If all you do is change the keywords used by the language, this should be pretty easy. – Doval Jun 02 '14 at 22:52

1 Answers1

2

Perform a simple, direct transliteration from the Arabic symbols to the English ones in CoffeeScript, and then run the result through the CoffeeScript compiler. Leave the remaining symbols unchanged.

That's by far the simplest and most reliable way to accomplish what you want, and probably the only way that doesn't require extended semantic analysis.

Robert Harvey
  • 198,589
  • 55
  • 464
  • 673