Announcement of Viscose scripting language

Source: Internet
Author: User

In fact, the viscose scripting language has been in existence for four years, but it has been only used in projects that you participate in, so that people around you know and are familiar with its syntax. today, I saw a blog listing a bunch of languages and platforms written by Chinese people. None of them are what viscose wants. this article is made public in special form.

Viscose is actually based on ironpython and so on. net script has the same idea: Use. net Program reflection mechanism, automatically..

The native data type of Viscose is: integer, double-precision floating point number, String. built-in none, point, pointf, array, MAP, guid.

Viscose supports classes, anonymous functions, JSON, and namespace. all class functions are virtual functions with no access control. All accesses are public and only single inheritance is supported. supports Operator Overloading (not all supported, but only because of efficiency). function parameters support references. data Type partition value type and reference type.

Keywords of Viscose include: If, Elif, else, while, break, continue, do, for, VAR, method, switch, Case, default, class, new, return, import, set, namespace

The Preprocessing symbols of Viscose are: True, false ,__ file __,__ line __,__ path __,__ abspath __;

Viscose accept # using, # include import other scripts.

Special variables of Viscose: @ self, @ base, @ set

Viscose's line comment is //, block comment is/**/, and special line comment is introduced: // <End all> indicates that all subsequent scripts are invalid and are mainly used for testing.

Viscose supports common arithmetic operations (Built-in power calculation), comparison operations, logical operations, bit operations

Special Syntax of Viscose:

Set

Set: = "set" expression "{" Suite "}";

In the suite block, the member variables in expression are preferentially referenced.

Import

Import: = "import" "*" | identifier expression ";"

Used to temporarily rename the name of a namespace or import all its contents.

Anonymous: Contains anonymous classes, anonymous variables, and anonymous functions.

Anonymous class: anonym_class: = "new" variable "{" class_body *"}";

Anonymous variable: anonym_variable: = "new" call_function;

Anonymous function: anonym_method: = "method" "(" argument_list ")" "{" Suite "}"

The most brilliant part of Viscose is the automatic import of. Net classes to extend the script function. Essentially, viscose can import all. NET functions without any operation. However, many times, we do not want scripts to have all the functions of the program.

Public ref class attribute: Public System: attribute;
Public ref class readonly: Public System: attribute;

It is used to control which classes and which functions, attributes, and variables can be provided to scripts.

Viscose provides automatic conversion between the vast majority of data types and script data types in. net, and also provides custom conversion interfaces.

Viscose intends to provide collaborative threads. However, because. NET is not completely thorough, there is not much progress in this regard.

The same program can run multiple viscose virtual machines at the same time. There is no interference between each virtual machine. It also provides the ability to run multiple script processes/multiple script threads under the same virtual machine.

Viscose provides the proxy function to seamlessly accept. NET functions/script functions as their proxy objects.

The following shows how to import the function of the. NET program to a script:

[Policyscript: vsattribute]
Public ref class testexport
{
Int m_nvalue;
Public:
[Policyscript: attribute]
Property int value {
Int get () {return m_nvalue ;}
Void set (int x) {m_nvalue = x ;}
}

[Policyscript: attribute]
System: Drawing: Color testfunc (int A, int B)
{
Debug: MSG (L "testfunc ({0}, {1});", a, B );
Return System: Drawing: Color: fromargb (a, B, 0xff );
}

[Policyscript: attribute]
Void testcolor (System: Drawing: Color CLR)
{
Debug: MSG (CLR. tostring ());
}
};

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.