Clear questions and runnable code
get the best and fastest answer
Sidef - The experimental scripting language written in Perlby trizen (Hermit)
|on Apr 17, 2014 at 13:28 UTC||Need Help??|
I remember that, a few years ago, someone asked a question about Writing a Programming Language in Perl. I was a little bit skeptical at first, but very interested in this subject too. Few years passed by, until me and a friend of mine decided to create a toy-language from scratch without using anything else, but Perl. We wanted it as simple as possible and powerful as much as it can be.
is equivalent with:
What? Yes, the above code is valid code. if(expr) returns an object which accepts methods like 'do', 'elsif' and 'else'.
This proves how flexible an OO language can be. The basic definition of Sidef is this: obj.method(obj), with minor exceptions.
In Sidef, the numbers have a very special purpose. We see the language as a toy-language and recommend to be seen only this way, but still it can be used in simple home-made projects, especially in those involving number computation. Numbers, by default, are represented by Math::BigFloat objects, giving them a better precision at the cost of being somewhat slower than Perl's standard representation for numbers (-Nfast).
Perl related features:
The project is available at: https://github.com/trizen/sidef
The documentation page: https://github.com/trizen/sidef/wiki
The RosettaCode page: http://rosettacode.org/wiki/Sidef
The very basic concept of the language can be found at: https://github.com/trizen/sidef/blob/master/utils/sidef_concept.pl