Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Writting Perl reserved words in Spanish or other foreign languages

by bquistorff (Novice)
on Oct 11, 2007 at 21:26 UTC ( #644328=perlquestion: print w/replies, xml ) Need Help??
bquistorff has asked for the wisdom of the Perl Monks concerning the following question:

Being a programming teacher with Spanish speaking students is always difficult because it forces them to learn to program while in a very uncomfortable and, for them, error-prone foreign language. I recently stumbled upon Perligata, which allows Perl to be written using Latin. I decided to see if a module could be made to allow Perl to be written in Spanish (or any other language for that matter). Like Perligata I want to translate the reserved words and built-in functions, but unlike Perligata I want to use the standard Perl grammar (Perligata uses Latin grammar and punctuation rules).

Does anyone have any suggestions for how to proceed? If there's full/complete tokenizer for Perl 5, I could used a source code filter (like Filter-Simple), but I can't use the Perl C code. Or would there be simpler ways in Perl 6, with which I'm not very familiar? - Thanks

  • Comment on Writting Perl reserved words in Spanish or other foreign languages

Replies are listed 'Best First'.
Re: Writting Perl reserved words in Spanish or other foreign languages
by Argel (Prior) on Oct 11, 2007 at 23:22 UTC
    But aren't there some downsides to this approach? Studying examples in books or the Internet or even real-world applciations will be much more difficult and the same can be said for using CPAN modules. And if they wanted to use Perl in the future on a project with others or even just wanted to ask for help they will be at a disadvantage.

    I guess the question is if sacrificing the future to teach them fundamentals now really worth it? What will these students be doing once the class is over? Are they mostly Computer Science students? Or is this class one of those one-offs they are forced to take? It seems like the one-offs would beneift from a Spanish version while anyone who will be doing more programming in the future would benefit from learning the real thing.

      It might still be helpfull as an intro. Learn basic programming concepts without having to learn two foriegn languages at once (perl AND english).

      Eric Hodges
        I know -- it's a really tough call to make and it's really hard to remember back to when the basics seemed so hard.

        I am reminded of my own education where I learned Pascal first and then took C as an elective. I know it's comparing apples to oranges (for the most part) but I feel Pascal was a waste of time.

        C may have been harder to learn (especially if I had started out with it) but at least it was much more useful later on in life (both in later college classes and in the job market). My C (and C++) are very rusty these days but I still reap some benfit when trying to get things to compile. I don't think I have even seen any Pascal since college.

        So I look at this and think to myself -- they will gain some beneift from learning the fundamentals in Spanish Perl but if they learn real Perl then they will also potentially benefit much more later on in life.

Re: Writting Perl reserved words in Spanish or other foreign languages
by TGI (Parson) on Oct 11, 2007 at 23:58 UTC

    I've never written a source filter, but Acme::Lingua::Pirate::Perl looks a lot simpler than the Perligata. You could probably use that as a starting point.

    I can see how this would be a good thing for new students to start programming with. But, like all training wheels, this aid will need to be removed at some point.

    Buena suerte!

    TGI says moo

Re: Writting Perl reserved words in Spanish or other foreign languages
by DrHyde (Prior) on Oct 12, 2007 at 10:15 UTC
    What are you trying to teach? If the aim is to teach perl then you really need to just bite the bullet and teach them perl as it is. If, on the other hand, the aim is to teach them programming, then maybe there is a pedagogical language you could use with keywords in $local_language. I know, for example, that there is a BASIC-variant in French, and someone else has mentioned Portugol. Both, I would imagine, would be reasonably comprehensible to a Spaniard or Latin American.

    But whatever you do, a plain old Filter::Simple source filter is not the solution. By the time you've managed to get it working OK such that it doesn't "translate" quoted text, or trip up on keywords that contain other keywords ('and' and 'rand', 'or' 'for' and 'foreach', 'int' 'print' and 'sprintf', no doubt there are others), or methods and functions from other libraries (many classes have a 'print' method), you'll have written a perl interpreter yourself.

      If one had to produce the source filtering code from scratch, I might agree with you.

      However, Filter::Simple offers the FILTER_ONLY interface, that makes it easy to specify code only transformation.

      package Lingua::Perl::Espanol; use Filter::Simple FILTER_ONLY code_no_comments => sub { s/push/empuja/g; s/use/usa/g; #... }; 1;

      All this is going to be used for is getting people used to basic concepts like flow control, stack operations, and so forth.

      One could pretty easily make the source filter so that it can be applied in chunks and each chunk could be incrementally removed:

      use Lingua::Perl::Espanol qw(no_list_ops no_flow);

      The above could make list operations (push, pop, splice, etc) and flow control keywords return to their standard English form, while keeping file operations and other groups in Spanish.

      If Filter::Simple works as advertised for simple code, then there is no technical reason not to use it. There may be pedagogical reasons not to use this approach. There are also similar reasons to use it. Which way will work better? I'd like to see some decent research that could answer that question.

      Since the barriers to trying this with Filter::Simple are so low, I believe it is worth trying. If this is successful, many people around the world could find learing to program much easier with the help of Perl.

      TGI says moo

        I know I'm over a year late, but this application just came up in some consulting work. I believe it to be a GOOD idea to have a utility (or pre-processor) that accepts Perl keywords in Spanish. Anything that HELPS an inner-city Hispanic kid learn about computer programming is a Very Good Thing, indeed. The goal is to learn how to think algorithmically, not struggle with the English language (what's "croak" in Spanish? Please do not give me the word for "die" ...).

        I disagree with the argument that it is a "waste of time" for the kids, and an "equivalent to teaching Pascal", which they will never use in the "real world" (BTW, where IS that place?). I learned Pascal very early on, never used it professionally (PL/1 was the closest), but I am thankful of the Pascal experience (Damian Conway did an excellent webcast on this subject and Perl6). In fact, I wish that there never WAS a working Pascal compiler, but that the language concept was taught in school nevertheless.

        My German friends use English reserved words, but German variable names and comments. So why not have a translator that converts the entire Perl script (but I'd be happy with just the reserved words and Standard Library names)?

        Since I have never written a parser, and have limited experience in Spanish, I searched for such a thing, but only found sources for Perl language TRAINING in foreign languages. I'm new around here, so I might have overlooked something. Does anyone know of such a thing?

        Thanks, Ray

Re: Writting Perl reserved words in Spanish or other foreign languages
by fernandes (Monk) on Oct 12, 2007 at 06:12 UTC

    Fisrt of all, I think if you base your teaching in a good introduction for symbolic logics (it is natural language independent, I believe), the remainig Perl subjects will appear simpler even for non-English speakers. May be not so difficult to be a programming teacher with Spanish speaking students, as to be a programming teacher with any students, when you do not dominate the fundamental. About this you must consider I'm brasilian speaking and philosopher...

    Although, it may really be uncomfortable to use a computer language not based in the natural mother language, most of all if you learn the computer language latter (and paying attention on translation of reserved words more than to logical meaning or symbolic semantics). This happens for natural languages as well. So, I sugest you take a look in Portugol. This is not Perl nor spanish, but C and brasilian, and you can even ask for the people involved about applications in Perl.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://644328]
Approved by ww
Front-paged by ikegami
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2018-06-18 08:24 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.