Explanation of the grammar of intellectual language

Source: Internet
Author: User

Smart language

The smart language is a fully Chinese interpreted programming language that is translated into JavaScript at runtime. All JavaScript syntax and components can be used directly. The Chinese grammar is carefully designed in the smart language. Before I speak the grammar of the language of wisdom, let me introduce the concept of intelligent language design.
Intelligent language design concept, intelligent language can express any need for computer (robot) to complete the logic. Smart language is an explanatory language that supports any advanced syntax that makes users more comfortable and makes users feel like they are using natural language. Because interpreted languages have advanced features, performance is less performance than other compiled languages. Fortunately, the computer is now fast computing, explaining the language has a lot of space to use. The current wisdom language is still in infancy (version 0.8), but because of the use of JavaScript technology, various functions are very stable, the features are still increasing. For high-performance usage scenarios, future smart language versions will provide language translation capabilities that transform the execution logic of the smart language into other compiled languages. The design goal of smart language is to become the most advanced language for connecting computers to humans.

Syntax description variable

Digital type:

5.5;

String type:

Define name = "Zhang San"= ' title '=' ${article title} Chinese programming changes the world ';

Single quotes, and double quotation marks are all representations of strings. The strongest is the anti-quote, in which the variable can be embedded when the template is used

Boolean type:

Whether the definition iscomplete = = yes;

There are only 3 simple types. Complex types include arrays, objects, functions, and so on, which are described later.

Basic code structure

At the end of the code statement, a line break is used to directly end the statement.
Use The delimited code can put more than one statement in a row.
{} represents a block of code. Where you can put multiple lines of statements.

A variable is an empty representation:

Define the selected car = empty;

Operation

Assignment operation:

Define a = 10; define B = 12;

Add, subtract, multiply, divide run:

c=a+b;c=a-b;c=a*b;c=a/b;

From (add, subtract, multiply, divide) operations:

A+=1; // The a variable is self-adding 1. equivalent to a=a+1; a-=2;a*=3;a/=2;

String Operations:

Define a= "China"; Define b= "Person"= a +// self-add operation. 

Comparison (Boolean) operations:

Define a=5; Define b=10; define c//To determine if A and B are equal, C is no // greater than, C is no // greater than or equal, The value of C is no

Process Control

If:

Define a = 10; define B =N, if (a>b) {    think. Print ("a>b");}

If, otherwise:

Define a = 10; define B =N, if (a>b) {    think. Print ("a>b");} Otherwise {    think. Print ("a<=b");}

Array

To create an array:

Define an array of goods = []; // empty array definition book array = ["AA", "BB"= Book array [0];   accesses an array of elements, with the subscript starting from the 0 commodity array. Added (123); // adding elements to an array

Function

To define a function:

function calculation (number 1, number 2, number 3) {    + 2 += function (number 1, number 2, number 3) {  // Assigning a function to a variable is also frequently used.     Returns the number 1 + number 2+ = calculation (12,33,44);  // calling Functions //

Object

To define an object:

Define student ={Name: "Zhang San", Age:--; print (student. name); print (student ["name"]); // Use variables to define coordinates ={};  // null object coordinates. x = 12; coordinates. y = +;   // Create object properties and assign values. 

The function of the object:

Define the car ={brand: "Ferrari" = function () {    think. Print ("drive ....") "+ I. brand);  // Use the "i" keyword to apply the object itself } cars. Driving ();     // function that invokes an object

Explanation of the grammar of intellectual language

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.