Hello everyone!
Have you ever heard of "delko scripting language"?
For those who do not know him long ago, in a post , I presented my little scripting language created by me.
How does it work?
Delko is actually a python file that parses a text file (script "Delko") and executes the commands that it finds.
The interpreter is still an ELF executable files in order to make the interpreter faster and easier to install
How do I install?
Follow this post.
Code Samples:
And here's to the "true" for this post.
I created the code, but I'll explain how to use it!
And so that list delko some codes and their "translation" in python!
Ready? Go!
Python
print "Hello World!"
Delko:
echo "hello world!" As you can see in
delko to send a string to output not using the "print" but the command "echo" inherited from PHP.
Python
a = "hello" to print
Delko:
set to "hello world" echo
to
Here is a substantial difference: in python to declare the variable just put the variable name, the = sign and content. In
delko using the "set" command, the variable name and without the = sign puts the contents of the variable
Python
a = 1 b = 2 c = a + b
Delko:
sets to a set B
math 2 c a + b
In python it is easier to perform mathematical operations, in delko must use the command "math" that sets a variable (in this case, the variable " c) as the result of a mathematical expression.
But here is where the potential delko:
Python: a = 5
b = 2 c = a / b
like 2 c it as both a and b are int () and float ()!
Delko:
five sets to set B 2
math ac / b
delko Even in this case turned out to be 2 because it is derived directly from two int () but if you use the numbers directly
Delko: c
math 5 / 2
In this case c is no more and no less than 2.5!
Now, another important thing, the use of then:
Python
a = 1 if a == 1:
[tab] print "equal"
else:
[tab ] print "different"
Delko:
set to 1 if a == 1
then echo "They are equal" else
then echo "I am different"
Note two things first: if the python In
must end with the two colon (:) while Delko is not necessary. In python you must insert the tab in delko while you use the command "then". On the basis of occurrences generated the command "then" is repeated several times
Python
a = 1 b = 1
if a == 1:
[tab] print "a equals a"
[ tab] if b == 1:
[tab] [tab] print "b is also equal to a"
Delko:
set B set to 1 if a == 1 1
then echo "a equals a"
then if b == 1 then
then echo "b is also equal to a"
As you can see the use of " then "instead of the tab is even more convenient, as the codes are posting in forums, blogs etc etc the code remains intact and not one problem (how many times by copying and pasting code does python not the fault of the tab?)
Ok all for now, I hope someone will try my language so as to let me know if there are problems! For those who know python
there are no problems in learning delko, taking into account that Delko is a language "game", that is created on a whim, and certainly not powerful as the python!
PS If some things do not work, forgive me but I use a version of delko (being its creator) in testing which will be released soon!
Hi!
ballot
0 comments:
Post a Comment