Home > Back-end >  Silk language - China's own open source programming language
Silk language - China's own open source programming language

Time:01-27

Silk language is a completely independent development of cross-platform open source type dynamic programming language, is by no means "mulan" set of shell, such as language,

Silk easy to learn, 30 minutes to master all the grammar, let you simply write a C/C + + style like a Python code,
Silk small size, can run the program with 600 k of executable files, and no third party dependence,
Silk is so powerful that can be used as embedded script any text, a web page to generate dynamic content, but also through the infinite extension DLL components,

Silk language example:
 
//calculate the Fibonacci sequence
Func Fibonacci (n)
{
If (n==0)
return 0;
Else if (n & lt;
=2)return 1;
The else
Return the Fibonacci (n - 1) + Fibonacci (n - 2);//recursive call
}

The main ()
{
//print before 20 the Fibonacci sequence
For (I=0; I & lt; 20; I++)
Print (Fibonacci (I));
}

Silk is a dynamically typed language, don't need to declare a variable type can be used:
 
The main ()
{
NCount=1;
DMile=100.68;
StrName="Wang Gang";
Print (nCount dMile, strName);
}

Silk has the rich data types, easy-to-use array, a dictionary and collection:
 
The main ()
{
Array1=[" good ", "OK");
Array2=[1, true, "great", null, array1, [100, 200]].
Print (array2);
Array2 [0]=99.99;
Print (array2 [0]);

Dict1={" name ":" wang ", "age" : 10, "other" : array1};
Print (dict1);
Dict1/"name"="Jack".
Print (dict1/"name");
}


Silk is an object-oriented programming language, create classes and objects is simple:
 
//parent Animal
The class Animal (name)
{
The self. The name=name;

Func description ()
{
Printf (" this is % s \ n ", the self. The name).
}
}
//subclass Dog
The class Dog (name)
{
The self=Animal (name);//inheritance parent Animal

Func elegantly-named SetName (name)
{
The self. The name=name;//call and modify the parent class defined in the attribute
}
}

The main ()
{
Dog dog=(" dog ");
T the description ();//call the superclass methods in the
T elegantly-named SetName (" pet ");//subclass methods defined in the
T the description ();
}

Silk is compatible with most of the C/C + + syntax, C/C + + program can be easily converted into Silk, C/C + + programmers can immediately Silk code:
 
//C adaptation of the positive integer prime factors
Func prime_factor (n)
{
Printf (" % d=", n);
For (I=2; i<=n; I++)
{
While (n % I==0)
{
Printf (" % d ", I);
N=n/I;
If (n!=1) printf (" * ");
}
}
printf("\n");//line breaks
}
The main ()
{
Prime_factor (2021);
}

Silk installation program contains a large number of adaptation of C/C + + example programs, including games, data structure, algorithm and so on, welcome everybody to Silk website Silklang.org ,
Making Silk source code download address: https://github.com/jetgu/Silk
Silk is only just started "small" language, there must be many shortcomings and defects, hope everyone to me blog message, criticize and correct me,
Your support is my the greatest power forward!

CodePudding user response:

Free look look

CodePudding user response:

Syntactic sugar is sweet, debugging error-detection more bitter!
The limited life waste in taste/tasting an infinite variety of syntactic sugar, I think is not worth while,

A may not be appropriate metaphor:
People want the dog to help catch a rabbit, but people talking dog didn't understand, so they invented a language between human speech and dog between language, namely password,
People want the computer to help do the calculations, but computers can't understand people words, so they invented a between human speech and language, assembly language code that the C language,
Password for a dog to make people easy to learn, have to let the dog is easy to understand,
C language also makes a person easy to learn, also have to make computers easier to understand,
Compared with the c + +, Java is study hard, a computer also often do not understand,

CodePudding user response:

refer to the second floor 4 teacher zhao response:
syntactic sugar is sweet, debugging error-detection more bitter!
The limited life waste in taste/tasting an infinite variety of syntactic sugar, I think is not worth while,

A may not be appropriate metaphor:
People want the dog to help catch a rabbit, but people talking dog didn't understand, so they invented a language between human speech and dog between language, namely password,
People want the computer to help do the calculations, but computers can't understand people words, so they invented a between human speech and language, assembly language code that the C language,
Password for a dog to make people easy to learn, have to let the dog is easy to understand,
C language also makes a person easy to learn, also have to make computers easier to understand,
Compared with the c + +, Java is study hard, a computer also often do not understand,

Thank you for your reply! Maybe as you said, there are so many language, to develop a new language is a waste of time, it is a personal hobbies, with their own development programming language sense is that others cannot understand, ha ha,

CodePudding user response:

reference qq_31972627 reply: 3/f
Quote: refer to the second floor 4 teacher zhao response:
syntactic sugar is sweet, debugging error-detection more bitter!
The limited life waste in taste/tasting an infinite variety of syntactic sugar, I think is not worth while,

A may not be appropriate metaphor:
People want the dog to help catch a rabbit, but people talking dog didn't understand, so they invented a language between human speech and dog between language, namely password,
People want the computer to help do the calculations, but computers can't understand people words, so they invented a between human speech and language, assembly language code that the C language,
Password for a dog to make people easy to learn, have to let the dog is easy to understand,
C language also makes a person easy to learn, also have to make computers easier to understand,
Compared with the c + +, Java is study hard, a computer also often do not understand,

Thank you for your reply! Maybe as you said, there are so many language, to develop a new language is a waste of time, it is a personal hobbies, with their own development programming language sense is that others cannot understand, ha ha,

Expect you to create a new programming language compiler debugging errors delicious invincible!

CodePudding user response:

Mainly is the syntactic sugar of the progress of the high-level language, finished it infrastructure in the early sixties and seventies
  • Related