A programming language similar to human natural language expression
A programming language similar to English syntactic structure
Because this is a kind of programming language similar to English syntax, but with some ambiguity removed, the structure is rigorous, and then Berry(My favorite fruit) and English are spliced together, that is, Belish.
Subject predicate object structure.
What's it meaning?
This is the action initiator, that is, the object that calls a function.
This represents the action to be performed, that is, the function name.
This represents the object of an action operation, which is also the parameter of a function.
I say "Hello!";
I
is the subject, say
is the predicate, "Hello!"
is the object.
If we translate this code into JavaScript, it is written as follows:
I.say("Hello!");
my sister say "Hello,", "John!";
my sister
is the subject, say
is the predicate, "Hello,"
, "John!"
is the object.
If we translate this code into JavaScript, it is written as follows:
I.sister.say("Hello,", "John!");
Variables or literals
Functions
Used to refer to an object
For logical operation
Such as and
or
<Subject> <Predicate> <Objects>.
def `verb-name`(`args`) {
# xxx
}
def `verb-name` -> `class-name`(`args`) {
# xxx
}
let `noun` = `value`;
let `pronoun` -> `value`;# Direct reference(Refers to the address of its value)
let `pronoun` => `value`;# Indirect reference(For a macro, it refers to the text 'value`)
Number(/(0[xob])?d+(.d+)?/), String(/"."/ or /'.'/), Null(null), Undefined(null), Object(/{.*}/)
=, :, ==, !=, <=, >=, <, >, ( ), [ ], { }, ., (comma), &, |, ^, ~, &&, ||, !, +, -, *, /, %, **, <<, >>, +=, -=, *-, /=, %=, **=, <<=, >>=, &=, |=, ^=, in, of, ~~
Format: <expr> in <expr>
Used to detect whether the second expr has a value with the keyword expr1.
Format: n~~m
Returns all integers in an interval [n, m)
note: If n, m is a floating point number, then the system automatically integrates the value of n, m downwards.
Use operator. to get properties in an object
Demo:
let b = a.b;
Use operator[] also can get properties
Demo:
let b = a["b"];
"[" "." 15
"(" 14
"++" "--" "!" "~" "**" 13
"" "/" "%" 12
"+" "-" 11
"<<" ">>" 10
">" ">=" "<" "<=" 9
"==" "!=" 8
"&" 7
"^" 6
"|" 5
"&&" 4
"||" "~~" 3
"=" "=" "/=" "%=" "+=" "-=" ">>=" "<<=" "^=" "&=" "|=" "in" "of" "=>" "->" 2
"," 1
// xxx
and # xxx
are Single-Line Comments.
/* xxx */
is the Multiline Comment.
We can omit the subject and refer to this.
Example:
print "Hello world!";