You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Flexible: Berry is a dynamic type script, and it's intended for embedding in applications. It can provide good dynamic scalability for the host system.
16
16
* Simple: simple and natural syntax, support garbage collection, and easy to use FFI (foreign function interface).
17
+
* RAM saving: With compile-time object construction, most of the constant objects are stored in read-only code data segments, so the RAM usage of the interpreter is very low when it starts.
17
18
18
19
## Documents
19
20
@@ -45,7 +46,7 @@ Berry has the following advantages:
45
46
* Control Structure
46
47
* Conditional statement: `if-else`
47
48
* Iteration statement: `while` and `for`
48
-
* Jump statement: `break`
49
+
* Jump statement: `break` and `continue`
49
50
* Function
50
51
* Local variable and block scope
51
52
* Return statement
@@ -56,9 +57,12 @@ Berry has the following advantages:
56
57
* Inheritance (only public single inheritance)
57
58
* Method and Operator Overload
58
59
* Constructor method
60
+
* Destructive method
59
61
* Module Management
60
-
* Statically allocated memory: no RAM used before import.
61
-
* Module nesting.
62
+
* Statically allocated memory: no RAM used before import
63
+
* Module nesting
64
+
* GC (Garbage collection)
65
+
* Mark-Sweep GC
62
66
63
67
## Build
64
68
@@ -110,33 +114,16 @@ Hello world!
110
114
You can copy this code to the REPL:
111
115
112
116
```ruby
113
-
deflist_iter(list)
114
-
index =0
115
-
defit()
116
-
value = list[index]
117
-
index = index +1
118
-
return value
117
+
deffib(x)
118
+
if (x <=1)
119
+
return x
119
120
end
120
-
returnit
121
+
returnfib(x -1) + fib(x -2)
121
122
end
122
-
l = [0, 1, 2, 3, 4, 5]
123
-
lout = []
124
-
it = list_iter(l)
125
-
v = it()
126
-
while (v !=nil)
127
-
lout.append(v)
128
-
v = it()
129
-
end
130
-
print(lout)
131
-
```
132
-
133
-
This examples is a simple list iterator. Let's look at the output:
134
-
135
-
```
136
-
[0, 1, 2, 3, 4, 5]
123
+
fib(10)
137
124
```
138
125
139
-
You can save the above code to a file (eg test.be) and run:
126
+
This example code will output the result `55`, and you can save the above code to a plain text file (eg test.be) and run this command:
0 commit comments