Skip to content

Commit fbee894

Browse files
committed
2 parents 66af547 + db780ae commit fbee894

File tree

9 files changed

+96
-95
lines changed

9 files changed

+96
-95
lines changed

docs/en/overview.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ nav:
88

99
# MCFPP Overview
1010

11-
Before the start: sentences of mcfpp is end up with semicolon.
11+
Before the start: statements of mcfpp is end up with semicolon.
1212

1313
## Project information file in JSON format<Badge type="tip">WIP</Badge>
1414

@@ -43,7 +43,7 @@ Project information file is situated on root of engineering catalogue, As an ent
4343

4444
### Variables
4545

46-
Declare : `type identifier (= expr)?;`
46+
Defination : `type identifier (= expr)?;`
4747

4848
Such as : `int i = 5 + p;``int x,y,z;`
4949

@@ -76,11 +76,11 @@ During Compiling, If any variable has been defined as literal, like `int i = 5;`
7676

7777
- const
7878

79-
`const` means a variable is always constant. That is, its value is given during compilation, and never changes. Such as `const int i = 5;`, `i` will be seem as constant during compiling. Constant is always static during compiling, and its value must be clear when we declare it, can't assign after declaring.
79+
`const` means a variable is always constant. That is, its value is given during compilation, and never changes. Such as `const int i = 5;`, `i` will be seem as constant during compiling. Constant is always static during compiling, and its value must be clear when we define it, can't assign after declaring.
8080

8181
- import <Badge type="warning">Deprecated</Badge>
8282

83-
`import` means a variable is import variable, it's value is imported from other place. Such as `import int i;`, `i` will be seen as import variable after compile. Often, variable only can be used after assignment, but if we use `import` modifier, Then variable can be used after declaration without assignment.
83+
`import` means a variable is import variable, it's value is imported from other place. Such as `import int i;`, `i` will be seen as import variable after compile. Often, variable only can be used after assignment, but if we use `import` modifier, Then variable can be used after defination without assignment.
8484

8585
### Comment
8686

@@ -134,13 +134,13 @@ for(forinit;bool;forupdate){
134134

135135
## Namespace
136136

137-
Each file's namespace can be declared independently
137+
Each file's namespace can be defined independently
138138

139139
```cpp
140140
namespace xxx;
141141
```
142142

143-
If the file haven't declared a separate namespace, the namespace defaults to the namespace set in the project configuration file.
143+
If the file haven't define a separate namespace, the namespace defaults to the namespace set in the project configuration file.
144144

145145
## Function
146146

@@ -156,7 +156,7 @@ func test(int i) -> int{
156156
157157
```
158158

159-
Function's namespace is decided by the file's namespace. If the file haven't declared a separate namespace, the namespace defaults to the namespace set in the project configuration file.
159+
Function's namespace is decided by the file's namespace. If the file haven't defined a separate namespace, the namespace defaults to the namespace set in the project configuration file.
160160

161161
:::tip Tip
162162
In mcfpp, function name can contains most utf-8 characters, but the compiled mcfunction's name will only contains characters, underline and numbers. The illegal characters will be replaced by `_uxxxx`.
@@ -291,15 +291,15 @@ class Student{
291291

292292
### Abstract
293293

294-
Add `abstract` keyword before class can declare the class as abstract class. Abstract function can't be instantiate.
294+
Add `abstract` keyword before class can define the class as abstract class. Abstract function can't be instantiate.
295295

296-
Add `abstract` keyword before function can declare the function as abstract function. Abstract function can't include function body.
296+
Add `abstract` keyword before function can define the function as abstract function. Abstract function can't include function body.
297297

298298
### Extension Function
299299

300-
Extension Function makes you can "add" function to current types. And don't need to create new derived type, recompile or change original data type by other methods. Extension function declares out of the class, but it also can be called, as other functions in the class.
300+
Extension Function makes you can "add" function to current types. And don't need to create new derived type, recompile or change original data type by other methods. Extension function defined out of the class, but it also can be called, as other functions in the class.
301301

302-
Declares extension function in the form of `Class name.Function name`, for example:
302+
Define extension function in the form of `Class name.Function name`, for example:
303303

304304
```cpp
305305
namespace test;
@@ -341,13 +341,13 @@ interface InterfaceName{
341341
}
342342
```
343343

344-
You can declare abstract function in the interface. Interface can inherit from other interfaces.
344+
You can define abstract function in the interface. Interface can inherit from other interfaces.
345345

346346
## Template <Badge type="tip">WIP</Badge>
347347

348348
Structure is a datatype that totally makes up by score board. So structure only can contain score board, that's `int` type variables as members.
349349

350-
When declaring field, we can ignore type ‘int'. Except this, structure is almost the same as class.
350+
During the defination of field, we can ignore type ‘int'. Except this, structure is almost the same as class.
351351

352352
Here's an example of structure:
353353

@@ -387,9 +387,9 @@ MNI is similar with the JNI in Java, is a kind of programming framework, makes t
387387

388388
### native function
389389

390-
native can be declared in classes or functions, Used to run a specific Java function when **compiling**.
390+
native can be defined in classes or functions, Used to run a specific Java function when **compiling**.
391391

392-
It's declaration is like this:
392+
It's defination is like this:
393393

394394
```cpp
395395
func test(params...) -> returnType = packagename.classname.funcname;

docs/en/quickstart/02base/01variables.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ lastUpdated: true
44

55
# Variable
66

7-
## Declaration of variables
7+
## Defination of variables
88

9-
Same as other languages, you can declare some variables in MCFPP for store, transfer and process data.
9+
Same as other languages, you can define some variables in MCFPP for store, transfer and process data.
1010

11-
The declaration of data is like this:
11+
The defination of data is like this:
1212

1313
```mcfpp
1414
#Type of data Identifier of data (optional: = expression or value )
1515
int i = 5;
1616
int b = i * 6;
1717
```
1818

19-
The identifier of variable can be the combination of any characters and numbers. In one scope, a name of variable only can declared once.
19+
The identifier of variable can be the combination of any characters and numbers. In one scope, a name of variable only can defined once.
2020

2121
## Type of variable
2222

docs/en/quickstart/02base/03logic-statements.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
lastUpdated: true
33
---
44

5-
# 逻辑语句
5+
# Logic statements
66

77
::: tip
8-
MCFPP中的逻辑语句和C/Java中的逻辑语句完全一致。如果你对其他语言足够熟悉,你可以跳过这一节。
8+
The logic statement of MCFPP is totally the same as in C/Java. You can skip this chapter if you already know it.
99
:::
1010

11-
## if语句
11+
## if statement
1212

13-
`if`语句是一种条件语句,它用来判断一个条件是否成立。如果条件成立,那么`if`语句中的代码块将会被执行。`if`语句的语法如下:
13+
`if` statement is a condition statement, it can used to determine a condition is true or false. If true, then the code in the `if` statement block will be execute. The grammar of `if` is:
1414

1515
```mcfpp
1616
if (condition){
1717
#code
1818
}
1919
```
2020

21-
`condition`是一个布尔表达式,它的值为`true``false`。如果`condition`的值为`true`,那么`#code`中的代码块将会被执行。
21+
`condition` is a boolean expression, it’s value is `true` or `false`. If the value of `condition` is `true`, then `#code` will be execute.
2222

23-
`if`语句还可以和`else`语句一起使用,`else`语句用来在`if`语句的条件不成立时执行代码块。`if-else`语句的语法如下:
23+
`if` statement can be used together with `else` statement, `else` statement used to execute the code when the condition in `if`is false. The grammar of `if-else` is shown:
2424

2525
```mcfpp
2626
if (condition){
@@ -30,9 +30,9 @@ if (condition){
3030
}
3131
```
3232

33-
`condition`是一个布尔表达式,它的值为`true``false`。如果`condition`的值为`true`,那么`#code1`中的代码块将会被执行;否则,`#code2`中的代码块将会被执行。
33+
`condition` is a boolean expression, it’s value is `true` or `false`. If the value of `condition` is `true`, then `#code1‘ will be execute; Else, ’#code2‘ will be execute.
3434

35-
可以使用`else if`语句用来在`if`语句的条件不成立时判断另一个条件。`if-else if-else`语句的语法如下:
35+
We can use `else if` to add another condition when `if` is false. The grammar of `if-else if-else` is shown below:
3636

3737
```mcfpp
3838
if (condition1){
@@ -44,47 +44,47 @@ if (condition1){
4444
}
4545
```
4646

47-
## while语句和do-while语句
47+
## while statement and do-while statement
4848

49-
`while`语句是一种循环语句,它用来重复执行一个代码块,直到条件不成立。`while`语句的语法如下:
49+
`while` is a loop statement, it can execute a code block repeatedly, until the condition is false. The grammar of `while` statement is:
5050

5151
```mcfpp
5252
while (condition){
5353
#code
5454
}
5555
```
5656

57-
`condition`是一个布尔表达式。如果`condition`的值为`true`,那么则执行`#code`代表的代码块。此后,再次判断`condition`的值,如果`condition`的值为`true`,那么`#code`代表代码块将会被执行;如此循环,直到`condition`的值为`false`
57+
`condition` is an boolean expression, when `condition` is `true`, it’ll execute the code block in `#code`. Then, determine the value of `condition` again. If value of `condition` is `true`, then `#code` will be execute; loop again and again, until the value of `condition` is `false`.
5858

59-
`do-while`语句和`while`类似,但是无论条件是否成立,它都会先执行因此循环体中的语句,而后再判断条件来决定是否继续进行。`do-while`语句的语法如下:
59+
`do-while` statement is similar with `while` statement, but no matter the condition is true or false, it’ll execute the statement in the loop once, and then determine the condition to see continue execution or not. The grammar of `do-while` is shown below:
6060

6161
```mcfpp
6262
do{
6363
#code
6464
}while (condition);
6565
```
6666

67-
## for语句
67+
## for statement
6868

69-
`for`语句是循环的一种稍复杂的版本,它的语法如下:
69+
`for` statement is a more complex version of loop, it’s grammar is:
7070

7171
```mcfpp
7272
for (forinit; condition; forupdate){
7373
#code
7474
}
7575
```
7676

77-
`forinit`是一个初始化表达式,它用来初始化循环变量。`condition`是一个布尔表达式,它用来判断循环是否继续。`forupdate`是一个更新表达式,它用来更新循环变量。`#code`代表了循环体,即循环体中的代码。在运行的时候,`for`语句的执行过程如下:
77+
`forinit` is an initialization expression, used to initialize loop variable. `condition` is a boolean expression, used to determine if the loop keeps going on. `forupdate` is a update expression, used to update the variable of the loop. `#code` represents the loop body, which is the code in the loop. The execute process of `for` is shown below:
7878

79-
1. 执行`forinit`,初始化循环变量。
80-
2. 判断`condition`的值,如果`condition`的值为`true`,则执行`#code`代表的代码块,然后执行`forupdate`,更新循环变量,再次判断`condition`的值。
81-
3. 如果`condition`的值为`false`,则退出循环。
79+
1. Execute `forinit`, initialize the loop variable.
80+
2. Determine the value of `condition`, if the value of `condition` is `true`, execute `#code`, then execute `forupdate`, to update the loop variable, and determine the value of `condition` again.
81+
3. If the value of `condition` is `false`, exit the loop.
8282

83-
`for`循环中,`forinit`声明的变量只在`for`循环中有效。
83+
In `for` loop, the declaration of variable `forinit` only valid in the `for` loop.
8484

85-
## break和continue语句
85+
## break and continue statement
8686

87-
`break`语句用来跳出整个循环,`continue`语句用来跳过本次循环。例如:
87+
`break` statement used to jump out the whole loop, `continue` statement used to skip the current loop. For example:
8888

8989
```mcfpp
9090
for (int i = 0; i < 10; i++){
@@ -98,6 +98,6 @@ for (int i = 0; i < 10; i++){
9898
}
9999
```
100100

101-
在上面的例子中,当`i`的值为`5`时,`break`语句会跳出整个循环;当`i`的值为`3`时,`continue`语句会跳过本次循环,直接进行下一次循环。因此,i在每次循环中的变化为:`0``1``2``4``5`,最后跳出循环。
101+
In this example, when the value of `i` is `5`, `break`will jump out of the loop; when the value of `i` is `3`, `continue` will jump this loop, go to the next loop directly. So, the change of I in each loop are:`0``1``2``4``5`, and finally jump out.
102102

103-
`break``continue`语句只能在循环中使用。
103+
`break` and `continue` statement only can be used in the loop

docs/en/quickstart/02base/04top-statements.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
lastUpdated: true
33
---
44

5-
# 顶层语句
5+
# Top statement
66

7-
在MCFPP中,允许在文件的开始直接编写语句而无需额外定义函数,即顶层语句。顶层语句处于一个隐式的函数中,这个函数每个文件有且只有一个,且不能被外部调用。它的返回值类型为`void`
7+
In MCFPP, allows programming statements in the start of the file and don’t need to define extra function, that’s the top statement. Top statement places in a hidden function, each file have one and only one of this function, and it cannot be called externally. Its returned value’s type is `void`.
88

99
```mcfpp
1010
print("Top statement");
@@ -14,9 +14,9 @@ func main(){
1414
}
1515
```
1616

17-
在编译后,会生成两个函数——分别对应main函数以及顶层语句对应的默认函数。
17+
After compiling, it’ll form two functions —— corresponding to main function and the default functions of top statement respectively.
1818

19-
顶层语句只能在文件的开始编写,即在函数定义或类定义之前。顶层语句可以调用文件中声明的其他函数和类
19+
Top statement only can program in the start of the file, which is before the defination of any functions or classes. Top statement can call the other functions and classes that’s defined in the file.
2020

2121
```mcfpp
2222
main();

docs/en/quickstart/03namespace/01namespace.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
lastUpdate: true
33
---
44

5-
# 命名空间
5+
# Namespace
66

7-
MCFPP中的命名空间和MC中的命名空间是同一种东西。这也意味着,命名空间只能是小写字母、数字,点和下划线的组合。
7+
The namespace in MCFPP is same as the namespace in Minecraft. That means, namespace only can be the combination of lowercase letters, numbers, dots and underlines.
88

9-
你可以在文件中声明一个命名空间,这样文件中的所有函数和变量都会被放置在这个命名空间中。例如:
9+
You can declare a namespace in a file, so all functions and variables in the file will be placed in the namespace. For example:
1010

1111
```mcfpp
1212
namespace test;
1313
14-
func test(){ # test:test函数
14+
func test(){ # test:test function
1515
print(i);
1616
}
1717
```
1818

19-
一个文件中只能声明一次命名空间。
19+
You can only define namespace once in a file.
2020

21-
同样的,你也可以在项目配置文件中声明这个命名空间。
21+
The same, you can also define this namespace in the project configuration file.
2222

2323
```json
2424
{
@@ -31,7 +31,7 @@ func test(){ # test:test函数
3131
"D:/workspace/mcfpp/another_project.json"
3232
],
3333
"targetPath":"./out",
34-
//工程的默认命名空间。可选,默认为default // [!code focus]
34+
//The default namespace of the project. Optional, default is ‘default’ // [!code focus]
3535
"namespace":"mcfpp" // [!code focus]
3636
}
3737
```

docs/en/quickstart/04function/01define-and-call.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,54 @@
22
lastUpdate: true
33
---
44

5-
# 定义和调用
5+
# Define and call
66

7-
MCFPP函数的定义方式和C/Java有较大的区别,而更加接近于Python的语法。
7+
The way of define function in MCFPP has some differences with C/Java, and more similar to the grammar of Python.
88

9-
## 函数定义
9+
## Function definition
1010

11-
MCFPP中,函数的定义语法如下:
11+
In MCFPP, the grammar of define a function is shown below:
1212

1313
```mcfpp
1414
func functionName(parameter1, parameter2, ...) -> returnType{
15-
#函数体
15+
#Function body
1616
}
1717
```
1818

19-
`func`是函数的关键字,`functionName`是函数的标识符或者说名字,而紧随其后的`parameter1, parameter2, ...`则是函数的参数列表,`returnType`是可选的,即函数的返回类型。函数体则是由`{}`包裹的一系列语句。下面是一个实际的例子:
19+
`func` is the key word of function `functionName` is the identifier or name of the function, the following `parameter1, parameter2, ...` is the parameter list of the function,`returnType`is optional, which is the returned type of the function. Function body is a series of statements surrounded by `{}`. Here’s a example below:
2020

2121
```mcfpp
2222
func add(int a, int b) -> int{
2323
return a + b;
2424
}
2525
```
2626

27-
这个函数的名字是`add`,它有两个整数类型的参数`a``b`,返回值也是一个整数类型。这个函数的作用是把两个参数相加并返回结果。
27+
The name of the function is `add`, it have two integer-type parameters `a` and `b`, return value is also integer type. Its function is add the two parameters and return them.
2828

2929
## return
3030

31-
`return`和Minecraft中的`return`命令作用相同,都是用于返回函数的返回值。它的语法即为`return expression;`,其中`expression`是一个表达式,它的值就是函数的返回值。
31+
`return` is same as the `return` command in Minecraft, both used to return the returned value of the function. It’s grammar is `return expression;`, `expression` is an expression, it’s value is the returned value of the function.
3232

33-
如果一个函数定义了返回值类型,那么它的每一个分支都必须有`return`语句,即函数必定返回一个值。且`return`语句返回的值必须和函数的返回值类型相同,或者是返回值类型的子类型。
33+
If a function defined the type of the returned value, then each branch of it must have `return` statement, so the function must would return a value. And the value that `return` statement returned must have the same type as the type of return value of the function, or the subtype of the returned value’s type.
3434

35-
如果一个函数没有定义返回值类型,那么默认为`void`,即不会返回任何值。这个时候,`return`语句仍然是可用的,但是它的语法变为`return;`,即不带任何表达式。它将会起到立刻终止函数运行的作用。
35+
If a function haven’t defined the return value’s type, then the default is `void`, which won’t return any value. Now, `return` statement is still available, but its grammar becomes `return;`, without any expression. Its function is stop the function immediately.
3636

37-
## 函数的调用
37+
## Call of function
3838

39-
MCFPP中,函数的调用语法和C/Java一样,即`functionName(parameter1, parameter2, ...);`。其中,`functionName`是函数的名字,`parameter1, parameter2, ...`是要传递给函数的参数。下面是一个实际的例子:
39+
In MCFPP, grammar of call function is the same as in C/Java
40+
, that’s `functionName(parameter1, parameter2, ...);`. In it, the `functionName` is the name of function,`parameter1, parameter2, ...` are the parameters to the function, here’s the example:
4041

4142
```mcfpp
4243
func test(){
43-
print(add(1, 2)); #上面定义的add函数
44+
print(add(1, 2)); #the add function defined before
4445
}
4546
```
4647

47-
这个例子中,`test`函数调用了`add`函数,并传递了两个参数`1``2``add`函数返回了`3`,因此`test`函数将会打印出`3`
48+
In this example, `test` function called `add` function, and sent two parameters `1` and `2`. `add` function returns `3`, so the `test` function will print `3`.
4849

49-
## 函数的传参
50+
## The argument of function
5051

51-
函数中,对参数的修改不会影响到函数外部的变量。例如:
52+
In the function, the change to the parameter won’t affect the variables out of the function. For example:
5253

5354
```mcfpp
5455
func test(int a){
@@ -58,8 +59,8 @@ func test(int a){
5859
void main(){
5960
int a = 0;
6061
test(a);
61-
print(a); #输出0
62+
print(a); #output 0
6263
}
6364
```
6465

65-
在这个例子中,`test`函数对传入的参数`a`进行了修改,但是`main`函数中的`a`并没有受到影响。
66+
In this case, `test` function modified the passed in parameter `a`, but the `a` in `main` function haven’t been affected.

0 commit comments

Comments
 (0)