-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
574 additions
and
87 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "mindustry_logic_bang_lang" | ||
version = "0.13.5" | ||
version = "0.13.6" | ||
edition = "2021" | ||
|
||
authors = ["A4-Tacks <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#** | ||
* 这是0.13.6新增的功能, 尝试在编译期进行一些计算 | ||
* | ||
* 目前支持的有op部分运算和set, 在数字时 | ||
* | ||
* 触发为一个匿名返回句柄的DExp其中仅有一行op或者set并且其返回值位为返回句柄替换符 | ||
* 当这个DExp被take时, 将会尝试进行计算. | ||
* | ||
* 目前仅支持数字, 字符串和变量并不被支持 | ||
* | ||
* 一些运算无法支持例如rand, 一些运算不方便支持例如严格相等和len noise angle | ||
* | ||
* 还有需要注意的是, 逻辑和本编译器的浮点运算误差和显示位数都有所不同, | ||
* 所以使用时需要注意 | ||
* | ||
* 还有一些运算细节问题, 以及逻辑浮点数的parser也有所差异, | ||
* 比如超长小数位逻辑的行为非常玄学, | ||
* 还有i64溢出数字逻辑可能会将其当做变量或极其玄学的溢出 | ||
* | ||
* 本编译器已经尽量做到更像逻辑的行为 | ||
*# | ||
|
||
take Num = ($ = 1/3;); | ||
take Foo = ($ = Num*3;); | ||
print Num","Foo; | ||
printflush message1; | ||
#* >>> | ||
print 0.3333333333333333 | ||
print "," | ||
print 1 | ||
printflush message1 | ||
*# | ||
|
||
take N = (set $ ($ = 1+2;);); | ||
print N; | ||
#* >>> | ||
print 3 | ||
*# | ||
|
||
take N = ($ = 1e3 / 10;); | ||
print N; | ||
#* >>> | ||
print 100 | ||
*# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.