7 Replies - 2226 Views - Last Post: 05 November 2011 - 08:16 AM

SMPL - new web programming language

I'm going to talk in this thread, my first one here, about the web programming language which I designed, SMPL.
--------------

SMPL is a light, free, open source programming language, designed to add a mixture of simplicity, organization and flexibility to the task of programming for the web.

SMPL is simple, easy and flexible! It is strong and dynamic typed, high organized and is characterized by high clarity, fixed naming patterns, easy debugging and supporting unicode from the core.

SMPL, from the inside, is based on PHP. So it can work correctly on any web server that has PHP 5 installed, without reinventing the wheel, allowing anybody to install it as easy as installing any other application built using PHP, it's even easer, it needs no configuration (of DBs as an example).
--------------

Wrong function names (as in addslashes() which addes back slashes and not slashes)!

In function names: sometimes verb first and sometimes nouns first!

It has no unicode support from the core (just some messy Multi-Byte functions which isn't enabled by default).

Its typing if weaker a lot more than the acceptable. I wanted a more organized language, weak-typing is sometimes just trying to guess the programmer's intention!! Also the implicit casting in comparison looks very very random.

I wanted a simpler, simpler not just easier, language which removes any additional non-needed parts.

I wanted an easier and more powerful debugging methods.

Many functions for nearly the same purpose: sort(), asort(), arsort(), ksort(), krsort(), natcasesort(), natsort(), rsort(), uasort(), usort(), uksort(), array_multisort(), array_shuffle() all of these are for arrays sorting! In SMPL you only need to use array_sort() with a parameter to choose the way you want.

Some new concepts for databases in ArraysDB the database management system of SMPL. Which is powerful as the traditional SQL DBMS but it is not relational and uses functions instead of writing SQL (yes, also no injection of course), and treats the whole DB as an organized array, that is saved in a single small file!

Also allowing any PHP programmer to edit the language, add extensions and make a lot of things with its core and functions!

Other than all of that I wanted a lot of new features to the language it self, from the syntactic sugar to functions. For example you can see the allowing of adding, subtracting, multiplying, and even dividing non-numeric values. Summing two arrays merges them, subtracting them gives you their difference, dividing a string by another splits the first string into an array...

--------------

SMPL is a preprocessor, just like PHP. The whole process of browsing a web page written in SMPL can be summarized in:

The web server receives the request from the browser, then passes the requested file to a file called smpl_translator.php.

The file smpl_translator.php, after checking that the file can be reached by users, reads its contents then by transforms it into tokens, checks the correctness of the code, then generates the equivalent PHP code, the executes the code by eval(). Note: The generated code is cached and the cache is removed each 24 hours.

PHP gets the code and processes it to its Byte-Code which is get executed by Zend Engine to get the result, which is returned to the browser.

SMPL functions are PHP functions, and its variables are PHP variables also, but all of them have certain prefixes when they are written in PHP, but they don't have these prefixes when used in SMPL.

SMPL is not the only language that uses a translator from it self to another high level language, Dart from Google, CoffeeScript, Pascal and Eiffel all uses "transcompilers" or translators.
--------------

SMPL's site wasn't originally in English, but in the last days I translated the main parts of the web site to English. Most of the site is translated (not really a lot) except the manual, only the downloading & Installation chapter is translated until now! I will try to translate more and more and write more soon.

Re: SMPL - new web programming language

Posted 05 November 2011 - 06:28 AM

Hi, Dormilich.

SMPL currently is only procedural, it doesn't support OOP or functional programming. I thought a lot of adding an OO support, but I didn't decide yet. It won't be that easy to create a language, were everything is an object and OOP where not everything is an object is worth nothing.

I don't really understand what do you mean by supporting design patterns!

For DBs, SMPL currently supports only ArraysDB management system, anyway SMPL is only at the Alpha version 0.3. I may try to add MySQL and SQLite support soon.

Re: SMPL - new web programming language

Posted 05 November 2011 - 08:05 AM

Hi.

Arrays in SMPL are lists with keys, just like PHP. Something like an array, with each element an array with two elements one for the 'key' and one for the 'value'..
Anyway, that's just the interpretation, SMPL arrays are not more than normal PHP arrays.
You can iterate arrays using the 'for' statement in SMPL, it is like 'foreach' in PHP with some differences.

I'm sorry. I don't really know anything about the patterns you named, but from a fast look on Wikipedia I could understand that they are related somehow to OOP.

But if I could understand something about the 'composite' pattern then you should know first that the only compound type in SMPL is 'Array'. The only way to process each element of the array is to loop through the elements of the array and make the process you want on each element. But you can search or sort the array without looping.

Re: SMPL - new web programming language

While I think it is impressive you created your own language I can't see much use for it if you can't implement OOP or even functions for that matter.

Thank you for your reply.
For the OOP, it's not really the matter that I can't, I'm somehow lazy to do a major development like that now and like most developers I'm used to the procedural paradigm, and find it useful and satisfies my needs.

OOP, as implemented in PHP, is not so difficult to implement, I have two ways:

To depend on the PHP model.

OR to implement it myself in a creative way..

I like the second one more.

But I don't like to support a paradigm partially in the language, 100% or not.