Zum Inhalt

Esperanta Programlingvo - First try

von Pharoah, 2. August 2009

Beiträge: 36

Sprache: English

ceigered (Profil anzeigen) 4. August 2009 14:14:40

Time for encouragement - if you beat javascript in popularity I'll give you a lollypop lango.gif

But seriously, can't hurt to try, and it'd be awesome to see most Vindozaj komputiloj with an arsenal of E++ programs onboard okulumo.gif When that day comes, I'll go 'whoah I was posting on that guy's thread when he first mentioned this!'

Rogir (Profil anzeigen) 4. August 2009 18:10:05

The article is quite right about its main message: programmers, or rather any specialised professionals who work mainly over the internet, are far better off working in a common language than in their own languages. And of course that one language should be a widely spread language like english. But once esperanto becomes the world language (somewhere within the next ten years or so okulumo.gif) that would soon replace english as the language for programmers. So I don't think programming should immediately start working in another language, but the spreading of esperanto of course must also take place there.

Pharoah (Profil anzeigen) 4. August 2009 19:41:00

Here's a question, what decimal format do you think I should use? My plan right now is to use the european form 123,456 which is technically the Esperanto standard. Thus, everything matching the regex "-?(d+,d*|d*,d+)" would be of type dekumo. On the other hand, this looks strange to me and it's rarely seen online.

So, what do you think, comma or period?

EDIT:

After further reading, it seems like the comma is internationally accepted, so I'll be using that. Now to write a proof-of-concept interpreter in Python.

ceigered (Profil anzeigen) 5. August 2009 06:45:59

Pharoah:Here's a question, what decimal format do you think I should use? My plan right now is to use the european form 123,456 which is technically the Esperanto standard. Thus, everything matching the regex "-?(d+,d*|d*,d+)" would be of type dekumo. On the other hand, this looks strange to me and it's rarely seen online.

So, what do you think, comma or period?

EDIT:

After further reading, it seems like the comma is internationally accepted, so I'll be using that. Now to write a proof-of-concept interpreter in Python.
Does this mean you are using '123,450.9' or '123.450,9' (one-hundred-and-three-thousand-four-hundred-and-fifty decimal nine)?

(edit: i would have gone with the model '123,450.9' like with US and Australian standards because they seem most prominent to me in programming languages, forgive me if I'm wrong)

RiotNrrd (Profil anzeigen) 6. August 2009 01:13:35

ceigered:... like with US and Australian standards because they seem most prominent to me in programming languages...
Just like English is. ridulo.gif

Pharoah (Profil anzeigen) 6. August 2009 01:20:19

Well, I'm not going to use thousands separators at all (since, really, when do you see those in programming), but for the literals I've decided to go with the 12,3 standard to represent twelve-point-three. It's not what I'm used to, either, but I figure it's not a tough adjustment to move one key to the left.

Rogir (Profil anzeigen) 6. August 2009 14:19:50

About the thousands separators: the SI (regulating the metric system and such) recommends using spaces because commas or points may be confusing.

Pharoah (Profil anzeigen) 6. August 2009 14:25:50

The type system is similar to Python's (if that means anything to anyone). For example, the literal 6500 gets pushed on the stack as an integer (entjero), while 6500, is a decimal type (dekumo) and '6500'/"6500" are strings (ĉenoj). I've got my first simple program working in the Python based interpreter:
'Kio estas via nomo? ' eligo skribu
enigo legu-linio
'Sal, ' eligo skribu
eligo skribu

ceigered (Profil anzeigen) 6. August 2009 15:33:29

RiotNrrd:
ceigered:... like with US and Australian standards because they seem most prominent to me in programming languages...
Just like English is. ridulo.gif
vi pravas, but this concerns that fine line between linguistic neutrality and mathematics... the one no one leaves from alive mwahaha

And Rogir that's what we do here in Australia often aswell but commas are used a lot in writing because it's hard to tell spaces apart. Or atleast that's my belief. The point being that I forgot that when writing my example because it's natural to use that here to avoid ambiguity (being an island no where near europe lango.gif). So my apologies ridulo.gif

And pharoah, good point, you never do use thousand seperaters do you? rido.gif but you answered my actual question so I think i understand now. Could using ',' as the decimal point interfere at all though with listing variables or values or that kind of thing though? or do you plan on using another method for that kind of stuff?

simple way to classify things with the type system too ridulo.gif

edit: Ne! vi forgesis 'saluton mondo' lango.gif

Pharoah (Profil anzeigen) 6. August 2009 15:51:32

And pharoah, good point, you never do use thousand seperaters do you? but you answered my actual question so I think i understand now. Could using ',' as the decimal point interfere at all though with listing variables or values or that kind of thing though? or do you plan on using another method for that kind of stuff?
Ah, but Simpla is a stack based language like FORTH or Factor or PostScript. When the interpreter encounters a literal, it pushes it's value on the stack. Then when a function (called a word) requires values, it pops them from the stack.

something like stdout.write() becomes
eligo skribu
str() becomes
al-ĉeno
and so stdout.write(str(2+2)) becomes:

2 2 + al-ĉeno eligo skribu

Edit:

'Saluton, mondo!' eligo skribu-linio.

(Should this be skribu-linioN?)

Zurück nach oben