Diez B. Roggisch wrote:
You could use import-hooks for importing your code. There was a python-magazine article a while ago that showed how to use that + a parser to import seamlessly a DSL.

I will look into this, right now i don't know what import-hooks are nor if i can use them from embedded python.

Using pyparsing to write a python-grammar on the fly that simply exchanges the keywords before passing it to the interpreter is also easy.

This could be an easy solution yes... unfortunately this makes other problems arise... for instance... if i have an IDE that shows the translated language and i want to debug it step by step... would it be easy for me to map the english version (the one that python sees) with the translated version? I still have to look at this and how to run the debugger from the application that is "hosting" python so for now the answer is "i don't know".

Right now, by simply changing the file Python-3.1.1/Grammar/Grammar i could obtain this (with "if" translated in "se"):

Python 3.1.1 (r311:74480, Feb 25 2010, 22:44:50)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> Vero = True
>>> stampa = print
>>>
>>> se Vero:
...   stampa("Ciao")
...
Ciao
>>>

Which seems to work, but requires to manually change the source code and it is way too complex for someone that has zero knowledge about the internals of python (like myself). Besides... it is a very ugly hack IMO.

But to be honest: I doubt it's worth the effort. Really. Teaching people how to code, but in something that is *not* the "real" language is of little, if any, benefit.

And also I don't think that your concerns are valid in general. Keywords are like brandnames or other things - the stand for a concept, and people immediatly accept them when they want them.

Maybe you are right, but being italian myself i can remember when i was a middle schooler (no computer before that) and the hours spent on my MSX figuring out how the thing worked. I learned all the commands as "brandnames" without really understanding them. I had _no_ idea that "if" meant... if, or that "print" meant to print. I had zero knowledge of english and for this reason most of these commands were meaningless to me, i didn't even suspect they had a meaning in an existing language, i just thought that was the way computers talked. When several years later, in High School, i learned English it was a real surprise for me to find out that the commands i had learned by heart as "magical words" actually had a precise meaning in "human language" and i think this would have helped me to figure out several things that instead took hours or days to understand. Now kids have internet, they study english from the kindergarten, they have a huge quantity of manuals and books freely available, so maybe you are right and i am just over-worrying. But still, i think it would be nice to use a language familiar to the kid (especially very young ones), it would make the learning process faster (no need to learn new words) and it would make the computer feel almost like a virtual "friend".

Much, much, much more important would - if anything - be a standard-library, or a wrapper for that, e.g. for turtle-graphics, that was written in terms of your desired language.

I already made some tests with turtle-graphics and it seems to work. My next problem was to translate the language.

http://img192.imageshack.us/img192/3093/zzz5.png

[Btw... i took too much time to write this post so the ladybug fell asleep...]

Thanx,
  Luca
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to