Skip to content

Commit 31d530e

Browse files
author
skiars
committed
update README.md
1 parent 315d68a commit 31d530e

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

README.md

+13-26
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Berry has the following advantages:
1414
* Powerful: supports imperative programming, object-oriented programming, functional programming.
1515
* 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.
1616
* 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.
1718

1819
## Documents
1920

@@ -45,7 +46,7 @@ Berry has the following advantages:
4546
* Control Structure
4647
* Conditional statement: `if-else`
4748
* Iteration statement: `while` and `for`
48-
* Jump statement: `break`
49+
* Jump statement: `break` and `continue`
4950
* Function
5051
* Local variable and block scope
5152
* Return statement
@@ -56,9 +57,12 @@ Berry has the following advantages:
5657
* Inheritance (only public single inheritance)
5758
* Method and Operator Overload
5859
* Constructor method
60+
* Destructive method
5961
* 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
6266

6367
## Build
6468

@@ -110,33 +114,16 @@ Hello world!
110114
You can copy this code to the REPL:
111115

112116
```ruby
113-
def list_iter(list)
114-
index = 0
115-
def it()
116-
value = list[index]
117-
index = index + 1
118-
return value
117+
def fib(x)
118+
if (x <= 1)
119+
return x
119120
end
120-
return it
121+
return fib(x - 1) + fib(x - 2)
121122
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)
137124
```
138125

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:
140127

141128
``` bash
142129
./berry test.be

0 commit comments

Comments
 (0)