Creating plugin for Arduino IDE

I want to create a plugin for Arduino IDE. any useful sources?

Plugin? What's it to do?

I'm thinking of a plugin that allow people to program using their own language. I'll start by Arabic for example. if the user enters "??"
that is "if" in English. the plugin will convert the Arabic syntax to English before the compiler take the syntax and compile it.

Can't that already be selected under File:Preference, then select Editor Language?
Some 30 or so languages are listed.
Arabic is the first one in the alphabetical list.

I apologize about my poor English. I didn't mean to translate the IDE itself! I want to translate the syntax!

for example:
this is the usual syntax:
if(x==1){
x=4;
}

I want the user to be able to writ it like this:
?? (?==1){
? = 4;

}

my plugin will basically take the Arabic Syntax and convert it to the corresponding English one. Can I do such a thing?

Have you ever written a parser? Worked with YACC (and LEX)? Does LALR mean anything to you?

If you are willing to use left-to-right reading order you may be able to get close to what you want using the preprocessor.

This is an interesting idea and I'm sure people who write Chinese or Japanese might be interested in something similar.

But ... (there is always a "but")

It will make it difficult or impossible for people who use those scripts to get help with their projects on this Forum. It can be difficult enough to figure out code that uses (say) french words for variable names even though all the language elements are in english.

And wouldn't this Thread be more suited to the Other Software Development section?

...R

@Coding Badly

no, this is the first time to hear about all of these terms. I looked up on the internet thought! but I believe it can be much simpler than that! all what I want to do is to do a one to one mapping between words, the Arabic word and the English word. is this possible?

@Robin2

you are absolutely right about getting help in this forums. but my goal is the educational purposes! for kids basically. a lot of kids in Arab countries don't know English very will, learning how to program in Arduino by they own language will be very helpful to them. if they got the idea and they like it, sure that will motivate them to learn English to be able to access the forums and other sources in the internet.

Rather than writing a plugin for the Arduino IDE what about using the option in the IDE for an external editor. Then you could write a program to convert the Arabic in the editor text file into an english version for the Arduino to verify and load.

This would mean that the student could have both the Arabic original and the English "translation" side by side. (I'm not sure whether you would consider that an advantage).

The "translation" program might just need to go through the Arabic file looking for key words and replacing them with the English equivalent. If you are aiming the product at beginners you might only need to allow for the common key words and not the more obscure C/C++ stuff.

It may also need to swap the order of all the words and symbols to left-to-right but that may be fairly simple to do.

...R

@Robin2
actually that's exactly what I want to do! can you give me more help? what do you mean by external editor! and how can I do it?
do you have a link or something that might help me?

Thanks in advance :slight_smile:

The opportunity to use an external editor is a standard part of the Arduino IDE. There is a box to tick in the Preferences. When that box is ticked you can't edit stuff in the IDE. Instead you edit the file in whatever program editing program you like (I use Gedit on Linux) and when you click Verify or Upload in the IDE it takes the latest version of the file that was saved by the editor.

Apart from that I doubt if I have much help to offer. I was thinking of you writing a PC program (in whatever language you know) which has a list of Arduino key words in Arabic and English (probably saved in a text file so you can easily add to the list). Then the program would go word by word through the Arabic program file and if any word matches an Arabic word in the list it would replace it with the English equivalent. Presumably it would be just as easy to go from English to Arabic.

I can see all sorts of complications including such simple things as how do you distinguish one word from the next? What happens if a student miss-spells a word? How do you deal with (for example) myservo.write() where the first part (myservo) can be anything the student wants but the second part is a keyword? And should the order of the pair be swapped in Arabic?

Another issue to consider is how the student will get feedbaack if his/her code fails to compile. The Arduino IDE will list the errors by reference to the English code.

...R

medoh772:
@Coding Badly

no, this is the first time to hear about all of these terms. I looked up on the internet thought! but I believe it can be much simpler than that! all what I want to do is to do a one to one mapping between words, the Arabic word and the English word. is this possible?

But that isn't what you showed in your example.
You are doing much more than a 1 to 1 mapping of words.

In your example, you didn't just substitute the "if".
you reversed some of the order but not all of it and also
changed some of the actual syntax.
That is going to make things VERY difficult as now you are going to have
actually write a parser.

medoh772:
I apologize about my poor English. I didn't mean to translate the IDE itself! I want to translate the syntax!

for example:
this is the usual syntax:
if(x==1){
x=4;
}

I want the user to be able to writ it like this:
?? (?==1){
? = 4;

}

my plugin will basically take the Arabic Syntax and convert it to the corresponding English one. Can I do such a thing?

In your example above, you actually even mentioned "syntax".
If you change the syntax, like you have done you will have to write a parser
as you are now no longer using C syntax.
Note that in your example,
the if has been moved to the right from the left, The parenthesis have moved
to no longer surround the expression
but yet the braces and the semicolon are still remaining on the right.
This is not just a simple word substitution.
You are changing the actual C language syntax
and also changing only some of left/right ordering
which is going to make things very difficult.

I think just handling the right<->left issues is quite difficult
without trying to change the syntax as well.

This looks like a very difficult task.

--- bill

Might be easier to write a short textbook (in Arabic) that explains enough English to do programming :slight_smile:

...R