operators
-
1.1 basic operator
(a + b) (a - b) (a / b) (a * b)
-
1.2 logic operator
(a > b) (a >= b) (a < b) (a <= b) (a == b) (a != b) (a || b) (a && b) (!a)
statement
-
2.1 def
def world = "hello"
-
2.2 const
const name = "china"
-
2.3 let
let year = 5000
-
2.4 array
def arr = [1, 2, 3]
-
2.5 JSON
def jsonObject = { name: 'yy' }
flow
-
3.1 if
if(name == 'china') { print("Descendants of the Dragon") }
-
3.2 match
match(name) { case 'Libai': 返回 print('故人西辞黄鹤楼, 烟花三月下扬州') case 'Zhangji': 返回 print("姑苏城外寒山寺, 夜半钟声到客船") case 'Sushi': 返回 print(`人生如逆旅,我亦是行人`) 默认: 返回 print('选择: 李白 | 张继 | 苏轼') }
-
3.3 loop
loop { print('选择: 李白 | 张继 | 苏轼') break }
-
3.4 for
def names = ['libai', 'Zhangji', 'Sushi'] for (currentName from names) { print(currentName) }
function
-
4.1 define
fn setName => (name) { print(name) }
-
4.2 call function
setName('Libai');
-
4.3 return
return "Libai";
Class
-
5.1 define
Class Ancient { constructor(person) { this.person = person } say() { print('Poetry') } }
-
5.2 instance
def libai = Ancient.new('Libai');
-
5.2 call
libai.say()
module
-
6.1 import
import fs as fs
-
6.2 export
// TODO export fs
others
In the history of programming language development, the grammatical structure is mostly based on English phrases, such as C (Denmark), Java (Canada), Python (Netherlands), Lua (Brazil), Rust (U.S.), but cuneiform is used as a grammatical expression , With natural simplicity and beauty, this project is only for learning and exploration, and does not discuss the advantages and disadvantages of language and culture