Compare commits
163 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b3d807bbc | |||
| 44b2ebb64a | |||
| eb7e2e7e93 | |||
| 77eddb83f4 | |||
| 4181ff8ae2 | |||
| 49b5e61e8e | |||
| e75a60026d | |||
| 83eb29fa3c | |||
| bc512fd02d | |||
| 0bbd82e9ce | |||
| 2fc2a93414 | |||
| 9bdc6245bf | |||
| 16ba11c391 | |||
| 19e473e93c | |||
| 5537a448e8 | |||
| caa62b0bfb | |||
| 3595631e2c | |||
| b033d53d28 | |||
| 8eda4fcbce | |||
| b02af0728a | |||
| b058ee4526 | |||
| 71cbb3a737 | |||
| ac0d3b9785 | |||
| f69dd85365 | |||
| c412d1194b | |||
| f39aece9cf | |||
| 439304c86a | |||
| 6e31185519 | |||
| 1c86c1dce7 | |||
| 1f8176d15e | |||
| f8a331809f | |||
| 0d6c6cef5a | |||
| 06bb647c83 | |||
| cc66eee75f | |||
| 1e2b0e4e0d | |||
| 1a0c3a38cb | |||
| fcdc3a49f8 | |||
| 139c42a90e | |||
| 2dfcc4c95e | |||
| 91aef32a42 | |||
| 18c9cbad7b | |||
| 310e909359 | |||
| d10b7336c1 | |||
| 3b39e9059b | |||
| c44f8a4630 | |||
| c4e9e541fb | |||
| da7d7bbcaa | |||
| d0c34ce1c2 | |||
| 1872221666 | |||
| 0a35289ad0 | |||
| 5f42beaf2a | |||
| b454d65962 | |||
| d536bd17ce | |||
| 3b3478ee30 | |||
| 926e87888c | |||
| f7db4fcce8 | |||
| 9afc1caac7 | |||
| 2a9d2b7f5f | |||
| f11303f0e8 | |||
| 7dd273759a | |||
| e626553a9c | |||
| b2c0b986c4 | |||
| a16f0ac059 | |||
| d3646c86ec | |||
| 39dff9efc5 | |||
| 80efd7c357 | |||
| 99345ddd19 | |||
| df07531edc | |||
| 5511978ed8 | |||
| 3406e1a2dd | |||
| 00f73ecb47 | |||
| e51ba01962 | |||
|
|
a9b4a6682a | ||
|
|
6c5bafb3e9 | ||
|
|
8d04397f32 | ||
|
|
7898505717 | ||
| 5fdb86cd1b | |||
|
|
60adecf808 | ||
|
|
4ae77434dc | ||
|
|
582ba2ce27 | ||
|
|
359c65228d | ||
|
|
3e7e5f2dad | ||
|
|
9a61798d81 | ||
|
|
9f3b3ad860 | ||
|
|
62f58cd83a | ||
|
|
a8cf93671e | ||
|
|
d11822f4ba | ||
|
|
87560db20d | ||
|
|
3a2a1363e6 | ||
| d54a2c59b6 | |||
| 4eb1aff553 | |||
| 80ee450b41 | |||
| f876f66414 | |||
| 2188171b63 | |||
| 7fab3cc662 | |||
| 62f2baab03 | |||
| 60388f6846 | |||
| 7c242d998f | |||
| d3a85a24bf | |||
| 477591303a | |||
| f4a269540a | |||
| cedc77cbc6 | |||
| f61cfa5638 | |||
| f6c877a7a1 | |||
| 6083c0b024 | |||
| b093f8db72 | |||
| 4a84f37b20 | |||
| 2a6fa8034c | |||
| 102e84bc01 | |||
| e5f23b77bd | |||
| 028561fc4f | |||
| 82f4ba1a6e | |||
| f1069d6e5d | |||
| ad11efe974 | |||
| 736e088a91 | |||
| d77368bb13 | |||
| e1a7f3310c | |||
| b7e9c8121e | |||
| 466b6ca2be | |||
| 1cb5951e68 | |||
| 1d73fc298e | |||
| 156f2b76c4 | |||
| 8e26b57cde | |||
| be8e57ef60 | |||
| 2c3c4089f8 | |||
| cadace165a | |||
| 15cd43a7d5 | |||
| f3409f32ce | |||
| 1293ac1f83 | |||
| 9a2b5d5e4e | |||
| fdeaa36366 | |||
| 3dfc8b63c8 | |||
| 30fa84604b | |||
| 025ea75f08 | |||
| c49b9f3df9 | |||
| d932ba10f0 | |||
| f1699bfbbe | |||
| 63835a1cce | |||
| 7c0a5e2524 | |||
| 1eaaacdf8c | |||
| 2f16dd2749 | |||
| 7395256b5a | |||
| 187ec7e0e9 | |||
| c334dd3e28 | |||
| 5b15b2d170 | |||
| 21e4668b16 | |||
| 5b8d7b98f3 | |||
| 63e8b0163a | |||
| 856d113b53 | |||
| 0cb2132e80 | |||
| 83b2122bd7 | |||
| 9132c79c54 | |||
| 12fc14e6e7 | |||
| 52d811b6aa | |||
| e0ad945202 | |||
| 2e4b76dfe2 | |||
| 9fb2dfae51 | |||
| 21ca6e6cab | |||
| 421eb0a0d9 | |||
| f5a6443c8a | |||
| 8d992001f9 | |||
| 4081d7d928 | |||
| 16a5d8d6ac |
2
.env
Normal file
2
.env
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Auto-generated by build\tools\generate-dotenv.ps1
|
||||||
|
SNOW_VERSION=0.8.0
|
||||||
@ -69,7 +69,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: 软件版本/分支
|
label: 软件版本/分支
|
||||||
options:
|
options:
|
||||||
- v0.5.0
|
- v0.8.0
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
- 其他
|
- 其他
|
||||||
|
|||||||
11
.run/Bug2.run.xml
Normal file
11
.run/Bug2.run.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Bug2" type="Application" factoryName="Application" folderName="BugFarm">
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/BugFarm/Bug2 -o target/Bug2" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
11
.run/Bug3.run.xml
Normal file
11
.run/Bug3.run.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Bug3" type="Application" factoryName="Application" folderName="BugFarm">
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/BugFarm/Bug3 -o target/Bug3 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
11
.run/Bug4.run.xml
Normal file
11
.run/Bug4.run.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Bug4" type="Application" factoryName="Application" folderName="BugFarm">
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/BugFarm/Bug4 -o target/Bug4 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
11
.run/Bug5.run.xml
Normal file
11
.run/Bug5.run.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Bug5" type="Application" factoryName="Application" folderName="BugFarm">
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/BugFarm/Bug5 -o target/Bug5 " />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Bug6.run.xml
Normal file
10
.run/Bug6.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Bug6" type="Application" factoryName="Application" folderName="BugFarm">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/BugFarm/Bug6 -o target/Bug6 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo1 -o target/Demo1 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo1 -o target/Demo1 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo10 -o target/Demo10 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo10 -o target/Demo10 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo11 -o target/Demo11 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo11 -o target/Demo11 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo12 -o target/Demo12 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo12 -o target/Demo12 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<configuration default="false" name="Demo13" type="Application" factoryName="Application" folderName="Demo">
|
<configuration default="false" name="Demo13" type="Application" factoryName="Application" folderName="Demo">
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo13 -o target/Demo13 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo13 -o target/Demo13 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -2,7 +2,15 @@
|
|||||||
<configuration default="false" name="Demo14" type="Application" factoryName="Application" folderName="Demo">
|
<configuration default="false" name="Demo14" type="Application" factoryName="Application" folderName="Demo">
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo14 -o target/Demo14 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo14 -o target/Demo14 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration default="false" name="Demo14" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo14 -o target/Demo14" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
10
.run/Demo15.run.xml
Normal file
10
.run/Demo15.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo15" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo15 -o target/Demo15 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo16.run.xml
Normal file
10
.run/Demo16.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo16" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo16 -o target/Demo16 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo17.run.xml
Normal file
10
.run/Demo17.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo17" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo17 -o target/Demo17 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo18.run.xml
Normal file
10
.run/Demo18.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo18" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo18 -o target/Demo18 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo19.run.xml
Normal file
10
.run/Demo19.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo19" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo19 -o target/Demo19 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo2 -o target/Demo2 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo2 -o target/Demo2 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
10
.run/Demo20.run.xml
Normal file
10
.run/Demo20.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo20" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo20 -o target/Demo20 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo21.run.xml
Normal file
10
.run/Demo21.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo21" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo21 -o target/Demo21 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo22.run.xml
Normal file
10
.run/Demo22.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo22" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo22 -o target/Demo22" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo23.run.xml
Normal file
10
.run/Demo23.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo23" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo23 -o target/Demo23 --debug" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo24.run.xml
Normal file
10
.run/Demo24.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo24" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo24 -o target/Demo24" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
10
.run/Demo25.run.xml
Normal file
10
.run/Demo25.run.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Demo25" type="Application" factoryName="Application" folderName="Demo">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
|
<module name="Snow" />
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo25 -o target/Demo25" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo3 -o target/Demo3 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo3 -o target/Demo3 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo4 -o target/Demo4 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo4 -o target/Demo4 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo5 -o target/Demo5 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo5 -o target/Demo5 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo6 -o target/Demo6 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo6 -o target/Demo6 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo7 -o target/Demo7 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo7 -o target/Demo7 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo8 -o target/Demo8 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo8 -o target/Demo8 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-ce-23" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
|
||||||
<module name="Snow" />
|
<module name="Snow" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo9 -o target/Demo9 -debug" />
|
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo9 -o target/Demo9 --debug" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="Run" type="CompoundRunConfigurationType">
|
|
||||||
<toRun name="build_project2tar.ps1" type="PowerShellRunType" />
|
|
||||||
<toRun name="Demo1" type="Application" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
6
.run/build-project2tar.ps1.run.xml
Normal file
6
.run/build-project2tar.ps1.run.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="build-project2tar.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/build-project2tar.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="build_project2tar.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/build_project2tar.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
<configuration default="false" name="build-release-all.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/build-release-all.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
||||||
<envs />
|
<envs />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration default="false" name="build_project2tar.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/build_project2tar.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
<configuration default="false" name="build-release-all.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/build-release-all.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
||||||
<envs />
|
<envs />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
6
.run/release-linux.ps1.run.xml
Normal file
6
.run/release-linux.ps1.run.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="release-linux.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/release-linux.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
6
.run/release-windows.ps1.run.xml
Normal file
6
.run/release-windows.ps1.run.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="release-windows.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/release-windows.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@ -5,7 +5,19 @@
|
|||||||
<toRun name="Demo11" type="Application" />
|
<toRun name="Demo11" type="Application" />
|
||||||
<toRun name="Demo12" type="Application" />
|
<toRun name="Demo12" type="Application" />
|
||||||
<toRun name="Demo13" type="Application" />
|
<toRun name="Demo13" type="Application" />
|
||||||
|
<toRun name="Demo14" type="Application" />
|
||||||
|
<toRun name="Demo15" type="Application" />
|
||||||
|
<toRun name="Demo16" type="Application" />
|
||||||
|
<toRun name="Demo17" type="Application" />
|
||||||
|
<toRun name="Demo18" type="Application" />
|
||||||
|
<toRun name="Demo19" type="Application" />
|
||||||
<toRun name="Demo2" type="Application" />
|
<toRun name="Demo2" type="Application" />
|
||||||
|
<toRun name="Demo20" type="Application" />
|
||||||
|
<toRun name="Demo21" type="Application" />
|
||||||
|
<toRun name="Demo22" type="Application" />
|
||||||
|
<toRun name="Demo23" type="Application" />
|
||||||
|
<toRun name="Demo24" type="Application" />
|
||||||
|
<toRun name="Demo25" type="Application" />
|
||||||
<toRun name="Demo3" type="Application" />
|
<toRun name="Demo3" type="Application" />
|
||||||
<toRun name="Demo4" type="Application" />
|
<toRun name="Demo4" type="Application" />
|
||||||
<toRun name="Demo6" type="Application" />
|
<toRun name="Demo6" type="Application" />
|
||||||
|
|||||||
57
Dockerfile
Normal file
57
Dockerfile
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Stage 1: 官方 GraalVM 社区版(已含 native-image)
|
||||||
|
FROM ghcr.io/graalvm/native-image-community:24.0.2 AS builder
|
||||||
|
|
||||||
|
RUN microdnf install -y \
|
||||||
|
gcc gcc-c++ make git wget tar gzip which findutils maven \
|
||||||
|
&& microdnf clean all
|
||||||
|
|
||||||
|
# ---------- 构建 musl ----------
|
||||||
|
ARG MUSL_VER=1.2.5
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN wget -q https://musl.libc.org/releases/musl-${MUSL_VER}.tar.gz \
|
||||||
|
&& tar -xzf musl-${MUSL_VER}.tar.gz \
|
||||||
|
&& cd musl-${MUSL_VER} \
|
||||||
|
&& ./configure --prefix=/opt/musl-${MUSL_VER} --disable-shared \
|
||||||
|
&& make -j"$(nproc)" \
|
||||||
|
&& make install \
|
||||||
|
&& ln -s /opt/musl-${MUSL_VER} /opt/musl \
|
||||||
|
&& cd / && rm -rf /tmp/musl-${MUSL_VER}*
|
||||||
|
|
||||||
|
RUN ln -s /opt/musl/bin/musl-gcc /usr/local/bin/x86_64-linux-musl-gcc \
|
||||||
|
&& ln -s /opt/musl/bin/musl-gcc /usr/local/bin/x86_64-linux-musl-cc
|
||||||
|
|
||||||
|
ENV PATH="/opt/musl/bin:${PATH}"
|
||||||
|
ENV CC="musl-gcc"
|
||||||
|
ENV C_INCLUDE_PATH="/opt/musl/include"
|
||||||
|
ENV LIBRARY_PATH="/opt/musl/lib"
|
||||||
|
|
||||||
|
# ---------- 静态 zlib ----------
|
||||||
|
ARG ZLIB_VERSION=1.3.1
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN wget -q https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
|
||||||
|
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
|
||||||
|
&& cd zlib-${ZLIB_VERSION} \
|
||||||
|
&& CC=musl-gcc ./configure --static --prefix=/opt/musl \
|
||||||
|
&& make -j"$(nproc)" \
|
||||||
|
&& make install \
|
||||||
|
&& cd / && rm -rf /tmp/zlib-${ZLIB_VERSION}*
|
||||||
|
|
||||||
|
# ---------- Maven 缓存优化 ----------
|
||||||
|
WORKDIR /app
|
||||||
|
COPY pom.xml ./
|
||||||
|
|
||||||
|
# 先拉依赖并缓存
|
||||||
|
RUN mvn -B -P native-linux dependency:go-offline
|
||||||
|
|
||||||
|
# ---------- 复制源码 ----------
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
# ---------- 编译 native image ----------
|
||||||
|
RUN mvn -P native-linux -DskipTests clean package
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Stage 2: 输出产物镜像(可以直接 cp 出二进制)
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
FROM busybox AS export
|
||||||
|
WORKDIR /export
|
||||||
|
COPY --from=builder /app/org.jcnc.snow.cli.SnowCLI /export/Snow
|
||||||
24
README.md
24
README.md
@ -11,8 +11,8 @@
|
|||||||
<a href="https://gitee.com/jcnc-org/snow/blob/main/LICENSE">
|
<a href="https://gitee.com/jcnc-org/snow/blob/main/LICENSE">
|
||||||
<img src="https://img.shields.io/badge/%20license-Apache--2.0%20-blue" alt="">
|
<img src="https://img.shields.io/badge/%20license-Apache--2.0%20-blue" alt="">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://gitee.com/jcnc-org/snow/tree/v0.5.0/">
|
<a href="https://gitee.com/jcnc-org/snow/tree/v0.8.0/">
|
||||||
<img src="https://img.shields.io/badge/version-v0.5.0-blue" alt="">
|
<img src="https://img.shields.io/badge/version-v0.8.0-blue" alt="">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ SnowVM) 的完整编译-执行链路。
|
|||||||
|
|
||||||
Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的语法和严格的类型系统,以帮助 LLM 更好地理解程序。
|
Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的语法和严格的类型系统,以帮助 LLM 更好地理解程序。
|
||||||
|
|
||||||
语言使用显式的 `module` 声明来组织代码,用 `function`,`parameter`,`return_type`,`body` 等关键字分隔不同代码块,语法结构固定且易读。此外,Snow
|
语言使用显式的 `module` 声明来组织代码,用 `function`,`params`,`returns`,`body` 等关键字分隔不同代码块,语法结构固定且易读。此外,Snow
|
||||||
实现了语义分析来检查变量作用域和类型一致性,在编译阶段捕获错误并确保生成的中间代码正确无误。这种自上而下的编译流程,使得代码设计和生成更加模块化,可解释,也有利于调试和优化。
|
实现了语义分析来检查变量作用域和类型一致性,在编译阶段捕获错误并确保生成的中间代码正确无误。这种自上而下的编译流程,使得代码设计和生成更加模块化,可解释,也有利于调试和优化。
|
||||||
|
|
||||||
相关背景: [心路历程](docs/Snow-Lang-Journey/Snow-Lang-Journey.md)
|
相关背景: [心路历程](docs/Snow-Lang-Journey/Snow-Lang-Journey.md)
|
||||||
@ -111,7 +111,7 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
|||||||
module: Main
|
module: Main
|
||||||
import:Math
|
import:Math
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
Math.add(6,1)
|
Math.add(6,1)
|
||||||
return 0
|
return 0
|
||||||
@ -135,7 +135,7 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
|||||||
3 15 IDENTIFIER main
|
3 15 IDENTIFIER main
|
||||||
3 19 NEWLINE \n
|
3 19 NEWLINE \n
|
||||||
|
|
||||||
4 9 KEYWORD return_type
|
4 9 KEYWORD returns
|
||||||
4 20 COLON :
|
4 20 COLON :
|
||||||
4 22 TYPE int
|
4 22 TYPE int
|
||||||
4 25 NEWLINE \n
|
4 25 NEWLINE \n
|
||||||
@ -174,10 +174,10 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
|||||||
#### Math.snow
|
#### Math.snow
|
||||||
module: Math
|
module: Math
|
||||||
function: add
|
function: add
|
||||||
parameter:
|
params:
|
||||||
declare n1: int
|
declare n1: int
|
||||||
declare n2: int
|
declare n2: int
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return n1 + n2
|
return n1 + n2
|
||||||
end body
|
end body
|
||||||
@ -195,7 +195,7 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
|||||||
2 15 IDENTIFIER add
|
2 15 IDENTIFIER add
|
||||||
2 18 NEWLINE \n
|
2 18 NEWLINE \n
|
||||||
|
|
||||||
3 9 KEYWORD parameter
|
3 9 KEYWORD params
|
||||||
3 18 COLON :
|
3 18 COLON :
|
||||||
3 19 NEWLINE \n
|
3 19 NEWLINE \n
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
|||||||
5 25 TYPE int
|
5 25 TYPE int
|
||||||
5 28 NEWLINE \n
|
5 28 NEWLINE \n
|
||||||
|
|
||||||
6 9 KEYWORD return_type
|
6 9 KEYWORD returns
|
||||||
6 20 COLON :
|
6 20 COLON :
|
||||||
6 22 TYPE int
|
6 22 TYPE int
|
||||||
6 25 NEWLINE \n
|
6 25 NEWLINE \n
|
||||||
@ -494,7 +494,7 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
|||||||
```snow
|
```snow
|
||||||
module: Math
|
module: Math
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
Math.factorial(6)
|
Math.factorial(6)
|
||||||
return 0
|
return 0
|
||||||
@ -502,9 +502,9 @@ module: Math
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function: factorial
|
function: factorial
|
||||||
parameter:
|
params:
|
||||||
declare n:int
|
declare n:int
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare num1:int = 1
|
declare num1:int = 1
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
48
build/build-project2tar.ps1
Normal file
48
build/build-project2tar.ps1
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# Set the tar package name
|
||||||
|
$tarName = "Snow.tar"
|
||||||
|
|
||||||
|
# Get the script's current directory (build folder)
|
||||||
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||||
|
|
||||||
|
# Get the parent directory (the project root)
|
||||||
|
$parentDir = Split-Path -Parent $scriptDir
|
||||||
|
|
||||||
|
# Set the full path to the tar package
|
||||||
|
$tarPath = Join-Path $parentDir $tarName
|
||||||
|
|
||||||
|
# Output message: starting to create tar package
|
||||||
|
Write-Output "Starting to create tar package: $tarName in $parentDir ..."
|
||||||
|
|
||||||
|
# Remove old tar package if it exists
|
||||||
|
if (Test-Path $tarPath) {
|
||||||
|
Write-Output "Found an old $tarName, removing it..."
|
||||||
|
Remove-Item $tarPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make sure the tar command is available
|
||||||
|
$tarCommand = "tar"
|
||||||
|
if (-not (Get-Command $tarCommand -ErrorAction SilentlyContinue)) {
|
||||||
|
Write-Error "❌ 'tar' command is not available. Please make sure 'tar' is installed and can be run from PowerShell."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute tar: change to org\jcnc directory and compress the snow folder
|
||||||
|
try {
|
||||||
|
# Build the command and run it
|
||||||
|
$tarCommandArgs = "-cf", $tarPath, "-C", "$scriptDir\..\src\main\java\org\jcnc", "snow"
|
||||||
|
Write-Output "Running tar command: tar $tarCommandArgs"
|
||||||
|
|
||||||
|
& $tarCommand @tarCommandArgs
|
||||||
|
} catch {
|
||||||
|
Write-Error "❌ Failed to create tar package. Error: $_"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if tar package was created successfully
|
||||||
|
if (Test-Path $tarPath) {
|
||||||
|
Write-Output "✅ Successfully created $tarName"
|
||||||
|
exit 0
|
||||||
|
} else {
|
||||||
|
Write-Error "❌ Creation failed. Please check the tar command and paths."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
129
build/build-release-all.ps1
Normal file
129
build/build-release-all.ps1
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
param(
|
||||||
|
[string]$LogDir = (Join-Path $PSScriptRoot 'target\parallel-logs')
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$winScript = Join-Path $PSScriptRoot 'release-windows.ps1'
|
||||||
|
$linScript = Join-Path $PSScriptRoot 'release-linux.ps1'
|
||||||
|
|
||||||
|
if (-not (Test-Path $winScript)) { throw "File not found: $winScript" }
|
||||||
|
if (-not (Test-Path $linScript)) { throw "File not found: $linScript" }
|
||||||
|
|
||||||
|
$winLogOut = [System.IO.Path]::GetTempFileName()
|
||||||
|
$winLogErr = [System.IO.Path]::GetTempFileName()
|
||||||
|
$linLogOut = [System.IO.Path]::GetTempFileName()
|
||||||
|
$linLogErr = [System.IO.Path]::GetTempFileName()
|
||||||
|
|
||||||
|
$winProc = Start-Process powershell.exe -ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File',"`"$winScript`"") `
|
||||||
|
-RedirectStandardOutput $winLogOut -RedirectStandardError $winLogErr -NoNewWindow -PassThru
|
||||||
|
$linProc = Start-Process powershell.exe -ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File',"`"$linScript`"") `
|
||||||
|
-RedirectStandardOutput $linLogOut -RedirectStandardError $linLogErr -NoNewWindow -PassThru
|
||||||
|
|
||||||
|
$winPosOut = 0
|
||||||
|
$winPosErr = 0
|
||||||
|
$linPosOut = 0
|
||||||
|
$linPosErr = 0
|
||||||
|
|
||||||
|
Write-Host "===== Build Started ====="
|
||||||
|
while (-not $winProc.HasExited -or -not $linProc.HasExited) {
|
||||||
|
# windows-release stdout
|
||||||
|
if (Test-Path $winLogOut) {
|
||||||
|
$size = (Get-Item $winLogOut).Length
|
||||||
|
if ($size -gt $winPosOut) {
|
||||||
|
$fs = [System.IO.File]::Open($winLogOut, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
||||||
|
$fs.Position = $winPosOut
|
||||||
|
$sr = New-Object System.IO.StreamReader($fs)
|
||||||
|
while (!$sr.EndOfStream) {
|
||||||
|
$line = $sr.ReadLine()
|
||||||
|
if ($line) { Write-Host "[windows-release][OUT] $line" }
|
||||||
|
}
|
||||||
|
$winPosOut = $fs.Position
|
||||||
|
$sr.Close()
|
||||||
|
$fs.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# windows-release stderr
|
||||||
|
if (Test-Path $winLogErr) {
|
||||||
|
$size = (Get-Item $winLogErr).Length
|
||||||
|
if ($size -gt $winPosErr) {
|
||||||
|
$fs = [System.IO.File]::Open($winLogErr, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
||||||
|
$fs.Position = $winPosErr
|
||||||
|
$sr = New-Object System.IO.StreamReader($fs)
|
||||||
|
while (!$sr.EndOfStream) {
|
||||||
|
$line = $sr.ReadLine()
|
||||||
|
if ($line) { Write-Host "[windows-release][ERR] $line" -ForegroundColor Red }
|
||||||
|
}
|
||||||
|
$winPosErr = $fs.Position
|
||||||
|
$sr.Close()
|
||||||
|
$fs.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# linux-release stdout
|
||||||
|
if (Test-Path $linLogOut) {
|
||||||
|
$size = (Get-Item $linLogOut).Length
|
||||||
|
if ($size -gt $linPosOut) {
|
||||||
|
$fs = [System.IO.File]::Open($linLogOut, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
||||||
|
$fs.Position = $linPosOut
|
||||||
|
$sr = New-Object System.IO.StreamReader($fs)
|
||||||
|
while (!$sr.EndOfStream) {
|
||||||
|
$line = $sr.ReadLine()
|
||||||
|
if ($line) { Write-Host "[linux-release][OUT] $line" }
|
||||||
|
}
|
||||||
|
$linPosOut = $fs.Position
|
||||||
|
$sr.Close()
|
||||||
|
$fs.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# linux-release stderr
|
||||||
|
if (Test-Path $linLogErr) {
|
||||||
|
$size = (Get-Item $linLogErr).Length
|
||||||
|
if ($size -gt $linPosErr) {
|
||||||
|
$fs = [System.IO.File]::Open($linLogErr, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
||||||
|
$fs.Position = $linPosErr
|
||||||
|
$sr = New-Object System.IO.StreamReader($fs)
|
||||||
|
while (!$sr.EndOfStream) {
|
||||||
|
$line = $sr.ReadLine()
|
||||||
|
if ($line) { Write-Host "[linux-release][ERR] $line" -ForegroundColor Red }
|
||||||
|
}
|
||||||
|
$linPosErr = $fs.Position
|
||||||
|
$sr.Close()
|
||||||
|
$fs.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Start-Sleep -Milliseconds 200
|
||||||
|
}
|
||||||
|
|
||||||
|
# After processes exit, print any remaining output
|
||||||
|
$tasks = @(
|
||||||
|
@{proc=$winProc; log=$winLogOut; tag='windows-release'; type='OUT'; skip=$winPosOut},
|
||||||
|
@{proc=$winProc; log=$winLogErr; tag='windows-release'; type='ERR'; skip=$winPosErr},
|
||||||
|
@{proc=$linProc; log=$linLogOut; tag='linux-release'; type='OUT'; skip=$linPosOut},
|
||||||
|
@{proc=$linProc; log=$linLogErr; tag='linux-release'; type='ERR'; skip=$linPosErr}
|
||||||
|
)
|
||||||
|
foreach ($item in $tasks) {
|
||||||
|
if (Test-Path $item.log) {
|
||||||
|
$fs = [System.IO.File]::Open($item.log, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
||||||
|
$fs.Position = $item.skip
|
||||||
|
$sr = New-Object System.IO.StreamReader($fs)
|
||||||
|
while (!$sr.EndOfStream) {
|
||||||
|
$line = $sr.ReadLine()
|
||||||
|
if ($line) {
|
||||||
|
if ($item.type -eq 'ERR') {
|
||||||
|
Write-Host "[$($item.tag)][ERR] $line" -ForegroundColor Red
|
||||||
|
} else {
|
||||||
|
Write-Host "[$($item.tag)][OUT] $line"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sr.Close()
|
||||||
|
$fs.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "All tasks completed successfully." -ForegroundColor Green
|
||||||
|
|
||||||
|
Remove-Item $winLogOut, $winLogErr, $linLogOut, $linLogErr -Force
|
||||||
|
exit 0
|
||||||
@ -1,47 +0,0 @@
|
|||||||
# 设定 tar 包的名称
|
|
||||||
$tarName = "Snow.tar"
|
|
||||||
|
|
||||||
# 获取脚本当前目录(build文件夹)
|
|
||||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
|
||||||
|
|
||||||
# 获取上一级目录(snow 根目录)
|
|
||||||
$parentDir = Split-Path -Parent $scriptDir
|
|
||||||
|
|
||||||
# 设置 tar 包的完整路径
|
|
||||||
$tarPath = Join-Path $parentDir $tarName
|
|
||||||
|
|
||||||
# 输出开始创建 tar 包的消息
|
|
||||||
Write-Output "开始创建 tar 包: $tarName 到 $parentDir ..."
|
|
||||||
|
|
||||||
# 如果存在旧 tar 包,先删除它
|
|
||||||
if (Test-Path $tarPath) {
|
|
||||||
Write-Output "发现旧的 $tarName,正在删除..."
|
|
||||||
Remove-Item $tarPath -Force
|
|
||||||
}
|
|
||||||
|
|
||||||
# 确保 tar 命令可用
|
|
||||||
$tarCommand = "tar"
|
|
||||||
if (-not (Get-Command $tarCommand -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Error "❌ tar 命令不可用。请确保 tar 已安装并可在 PowerShell 中执行。"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# 执行打包操作: 切换到 org\jcnc 目录下再压缩 snow 文件夹
|
|
||||||
try {
|
|
||||||
# 构建命令并执行
|
|
||||||
$tarCommandArgs = "-cf", $tarPath, "-C", "$scriptDir\..\src\main\java\org\jcnc", "snow"
|
|
||||||
Write-Output "执行 tar 命令: tar $tarCommandArgs"
|
|
||||||
|
|
||||||
& $tarCommand @tarCommandArgs
|
|
||||||
} catch {
|
|
||||||
Write-Error "❌ 创建 tar 包失败。错误信息: $_"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# 检查 tar 包是否创建成功
|
|
||||||
if (Test-Path $tarPath) {
|
|
||||||
Write-Output "✅ 成功创建 $tarName"
|
|
||||||
} else {
|
|
||||||
Write-Error "❌ 创建失败,请检查 tar 命令和路径是否正确。"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
136
build/release-linux.ps1
Normal file
136
build/release-linux.ps1
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
# run-linux-snow-export.ps1
|
||||||
|
# Build and package linux-snow-export, version read from SNOW_VERSION in .env
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
# Import shared dotenv parser function
|
||||||
|
. "$PSScriptRoot\tools\dotenv.ps1"
|
||||||
|
|
||||||
|
Write-Host "Step 0: Generate .env..."
|
||||||
|
try {
|
||||||
|
& "$PSScriptRoot\tools\generate-dotenv.ps1" -ErrorAction Stop
|
||||||
|
} catch {
|
||||||
|
Write-Error "Failed to generate .env: $( $_.Exception.Message )"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Step 1: Build and run linux-snow-export..."
|
||||||
|
docker compose run --build --rm linux-snow-export
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Build & Run failed, exiting script."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Step 2: Run linux-snow-export without rebuild..."
|
||||||
|
docker compose run --rm linux-snow-export
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Run without rebuild failed, exiting script."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== Step 3: Read version from .env =====
|
||||||
|
$projectRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||||
|
$dotenvPath = Join-Path $projectRoot ".env"
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $dotenvPath)) {
|
||||||
|
Write-Error ".env not found at: $dotenvPath"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$version = Read-DotEnvValue -FilePath $dotenvPath -Key 'SNOW_VERSION'
|
||||||
|
if (-not $version) {
|
||||||
|
Write-Error "SNOW_VERSION not found in .env"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== Step 4: Define output paths =====
|
||||||
|
$targetDir = Join-Path $projectRoot "target\release"
|
||||||
|
$outDir = Join-Path $targetDir "Snow-v$version-linux-x64"
|
||||||
|
$tgzPath = Join-Path $targetDir "Snow-v$version-linux-x64.tgz"
|
||||||
|
|
||||||
|
# ===== Step 5: Package to .tgz (no extra top-level dir, max compression) =====
|
||||||
|
Write-Host "Step 5: Package to .tgz..."
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $outDir)) {
|
||||||
|
Write-Error "Output directory not found: $outDir"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure target directory exists
|
||||||
|
if (-not (Test-Path -LiteralPath $targetDir)) {
|
||||||
|
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove old package if exists
|
||||||
|
if (Test-Path -LiteralPath $tgzPath) {
|
||||||
|
Write-Host "→ Removing existing tgz: $tgzPath"
|
||||||
|
Remove-Item -LiteralPath $tgzPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
function Invoke-TarGz {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)][string]$SourceDir,
|
||||||
|
[Parameter(Mandatory = $true)][string]$DestTgz
|
||||||
|
)
|
||||||
|
$tarExe = "tar"
|
||||||
|
|
||||||
|
$isWindows = $env:OS -eq 'Windows_NT'
|
||||||
|
|
||||||
|
if ($isWindows) {
|
||||||
|
$psi = @{
|
||||||
|
FilePath = $tarExe
|
||||||
|
ArgumentList= @("-C", $SourceDir, "-czf", $DestTgz, ".")
|
||||||
|
NoNewWindow = $true
|
||||||
|
Wait = $true
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$p = Start-Process @psi -PassThru -ErrorAction Stop
|
||||||
|
$p.WaitForExit()
|
||||||
|
if ($p.ExitCode -ne 0) {
|
||||||
|
throw "tar exited with code $($p.ExitCode)"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
throw "Packaging failed (Windows tar): $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$psi = @{
|
||||||
|
FilePath = $tarExe
|
||||||
|
ArgumentList= @("-C", $SourceDir, "-c", "-f", $DestTgz, "-I", "gzip -9", ".")
|
||||||
|
NoNewWindow = $true
|
||||||
|
Wait = $true
|
||||||
|
}
|
||||||
|
$p = Start-Process @psi -PassThru -ErrorAction Stop
|
||||||
|
$p.WaitForExit()
|
||||||
|
if ($p.ExitCode -eq 0) { return }
|
||||||
|
} catch { }
|
||||||
|
|
||||||
|
try {
|
||||||
|
$psi = @{
|
||||||
|
FilePath = $tarExe
|
||||||
|
ArgumentList= @("-C", $SourceDir, "-c", "-z", "-f", $DestTgz, ".")
|
||||||
|
NoNewWindow = $true
|
||||||
|
Wait = $true
|
||||||
|
}
|
||||||
|
$p = Start-Process @psi -PassThru -ErrorAction Stop
|
||||||
|
$p.WaitForExit()
|
||||||
|
if ($p.ExitCode -ne 0) {
|
||||||
|
throw "tar exited with code $($p.ExitCode)"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
throw "Packaging failed (Linux tar): $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Invoke-TarGz -SourceDir $outDir -DestTgz $tgzPath
|
||||||
|
} catch {
|
||||||
|
Write-Error $_.Exception.Message
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ">>> Package ready!" -ForegroundColor Green
|
||||||
|
Write-Host "Version : $version"
|
||||||
|
Write-Host "Output Dir : $outDir"
|
||||||
|
Write-Host "Tgz File : $tgzPath"
|
||||||
117
build/release-windows.ps1
Normal file
117
build/release-windows.ps1
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
# release-windows.ps1
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
|
||||||
|
# Import shared dotenv parser function
|
||||||
|
. "$PSScriptRoot\tools\dotenv.ps1"
|
||||||
|
|
||||||
|
# ===== Utility Functions =====
|
||||||
|
function Find-PomUpwards([string]$startDir) {
|
||||||
|
$dir = Resolve-Path $startDir
|
||||||
|
while ($true) {
|
||||||
|
$pom = Join-Path $dir "pom.xml"
|
||||||
|
if (Test-Path $pom) { return $pom }
|
||||||
|
$parent = Split-Path $dir -Parent
|
||||||
|
if ($parent -eq $dir -or [string]::IsNullOrEmpty($parent)) { return $null }
|
||||||
|
$dir = $parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== Step 0: Generate .env =====
|
||||||
|
Write-Host "Step 0: Generate .env..."
|
||||||
|
try {
|
||||||
|
& "$PSScriptRoot\tools\generate-dotenv.ps1" -ErrorAction Stop
|
||||||
|
} catch {
|
||||||
|
Write-Error "Failed to generate .env: $($_.Exception.Message)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== Step 1: Locate project root & build =====
|
||||||
|
Write-Host "Step 1: Locate project root and build..."
|
||||||
|
$pom = Find-PomUpwards -startDir $PSScriptRoot
|
||||||
|
if (-not $pom) {
|
||||||
|
Write-Error "pom.xml not found. Please run this script within the project."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$projectRoot = Split-Path $pom -Parent
|
||||||
|
Push-Location $projectRoot
|
||||||
|
try {
|
||||||
|
Write-Host "→ Running: mvn clean package"
|
||||||
|
mvn clean package
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "Maven build failed, exiting script."
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== Step 2: Read SNOW_VERSION =====
|
||||||
|
Write-Host "Step 2: Read SNOW_VERSION from .env..."
|
||||||
|
$dotenvPath = Join-Path $projectRoot ".env"
|
||||||
|
$snowVersion = Read-DotEnvValue -FilePath $dotenvPath -Key "SNOW_VERSION"
|
||||||
|
if (-not $snowVersion) {
|
||||||
|
Write-Host "SNOW_VERSION not found in .env, using placeholder 0.0.0." -ForegroundColor Yellow
|
||||||
|
$snowVersion = "0.0.0"
|
||||||
|
}
|
||||||
|
Write-Host "SNOW_VERSION = $snowVersion"
|
||||||
|
|
||||||
|
# ===== Step 3: Prepare release directory structure =====
|
||||||
|
Write-Host "Step 3: Prepare release directory structure..."
|
||||||
|
$targetDir = Join-Path $projectRoot "target"
|
||||||
|
$exePath = Join-Path $targetDir "Snow.exe"
|
||||||
|
if (-not (Test-Path $exePath)) {
|
||||||
|
Write-Error "Expected build artifact not found: $exePath"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$verName = "Snow-v${snowVersion}-windows-x64"
|
||||||
|
$releaseRoot = Join-Path $targetDir "release"
|
||||||
|
$outDir = Join-Path $releaseRoot $verName
|
||||||
|
$binDir = Join-Path $outDir "bin"
|
||||||
|
$libDir = Join-Path $outDir "lib"
|
||||||
|
|
||||||
|
# Clean old directory
|
||||||
|
if (Test-Path $outDir) {
|
||||||
|
Write-Host "→ Cleaning previous output directory..."
|
||||||
|
Remove-Item $outDir -Recurse -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
|
||||||
|
Copy-Item -Path $exePath -Destination (Join-Path $binDir "Snow.exe") -Force
|
||||||
|
Write-Host ">>> Collected Snow.exe"
|
||||||
|
|
||||||
|
# Optional lib
|
||||||
|
$projectLib = Join-Path $projectRoot "lib"
|
||||||
|
if (Test-Path $projectLib) {
|
||||||
|
New-Item -ItemType Directory -Force -Path $libDir | Out-Null
|
||||||
|
Copy-Item -Path (Join-Path $projectLib "*") -Destination $libDir -Recurse -Force
|
||||||
|
Write-Host ">>> Copied lib directory"
|
||||||
|
} else {
|
||||||
|
Write-Host ">>> lib directory not found, skipping." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===== Step 4: Create release zip =====
|
||||||
|
Write-Host "Step 4: Create release zip..."
|
||||||
|
New-Item -ItemType Directory -Force -Path $releaseRoot | Out-Null
|
||||||
|
$zipPath = Join-Path $releaseRoot ("{0}.zip" -f $verName)
|
||||||
|
if (Test-Path $zipPath) {
|
||||||
|
Write-Host "→ Removing existing zip: $zipPath"
|
||||||
|
Remove-Item $zipPath -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Compress-Archive -Path (Join-Path $outDir '*') -DestinationPath $zipPath -CompressionLevel Optimal -Force
|
||||||
|
} catch {
|
||||||
|
Write-Error "Failed to create zip: $($_.Exception.Message)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ">>> Package ready!" -ForegroundColor Green
|
||||||
|
Write-Host "Version : $snowVersion"
|
||||||
|
Write-Host "Output Dir : $outDir"
|
||||||
|
Write-Host "Zip File : $zipPath"
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
53
build/tools/dotenv.ps1
Normal file
53
build/tools/dotenv.ps1
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# tools/dotenv.ps1
|
||||||
|
# Unified .env reader function:
|
||||||
|
# - Supports `KEY=VAL` and `export KEY=VAL`
|
||||||
|
# - Skips blank lines and comments
|
||||||
|
# - Handles quoted values (single or double quotes)
|
||||||
|
# - Allows inline comments at the end of a line (space + #)
|
||||||
|
# - If the same KEY is defined multiple times, the last one takes precedence
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
|
||||||
|
function Read-DotEnvValue {
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)][string]$FilePath,
|
||||||
|
[Parameter(Mandatory=$true)][string]$Key
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $FilePath)) { return $null }
|
||||||
|
|
||||||
|
# Match the target key (escaped), allowing optional "export" prefix
|
||||||
|
$pattern = '^(?:\s*export\s+)?(?<k>' + [regex]::Escape($Key) + ')\s*=\s*(?<v>.*)$'
|
||||||
|
$value = $null
|
||||||
|
|
||||||
|
# Read line by line for large file compatibility
|
||||||
|
Get-Content -LiteralPath $FilePath | ForEach-Object {
|
||||||
|
$line = $_
|
||||||
|
|
||||||
|
# Skip blank lines and full-line comments
|
||||||
|
if ($line -match '^\s*$') { return }
|
||||||
|
if ($line -match '^\s*#') { return }
|
||||||
|
|
||||||
|
if ($line -match $pattern) {
|
||||||
|
$v = $matches['v']
|
||||||
|
|
||||||
|
# Remove surrounding quotes if present
|
||||||
|
$trimmed = $v.Trim()
|
||||||
|
if ($trimmed -match '^\s*"(.*)"\s*$') {
|
||||||
|
$v = $matches[1]
|
||||||
|
} elseif ($trimmed -match "^\s*'(.*)'\s*$") {
|
||||||
|
$v = $matches[1]
|
||||||
|
} else {
|
||||||
|
# Strip inline comments (space + # …), ignoring escaped \#
|
||||||
|
if ($v -match '^(.*?)(?<!\\)\s+#.*$') {
|
||||||
|
$v = $matches[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $v.Trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value
|
||||||
|
}
|
||||||
23
build/tools/generate-dotenv.ps1
Normal file
23
build/tools/generate-dotenv.ps1
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# build\tools\generate-dotenv.ps1
|
||||||
|
|
||||||
|
# Repository root: go up two levels from build\tools\
|
||||||
|
$repoRoot = (Get-Item $PSScriptRoot).Parent.Parent.FullName
|
||||||
|
$envPath = Join-Path $repoRoot ".env"
|
||||||
|
$pomPath = Join-Path $repoRoot "pom.xml"
|
||||||
|
|
||||||
|
if (-not (Test-Path $pomPath -PathType Leaf)) {
|
||||||
|
throw "pom.xml not found: $pomPath"
|
||||||
|
}
|
||||||
|
|
||||||
|
[xml]$pom = Get-Content $pomPath -Encoding UTF8
|
||||||
|
$version = $pom.project.version
|
||||||
|
|
||||||
|
$lines = @(
|
||||||
|
"# Auto-generated by build\tools\generate-dotenv.ps1"
|
||||||
|
"SNOW_VERSION=$version"
|
||||||
|
)
|
||||||
|
|
||||||
|
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||||
|
[System.IO.File]::WriteAllLines($envPath, $lines, $utf8NoBom)
|
||||||
|
Write-Host "Generated/overwritten $envPath (version: $version)"
|
||||||
|
return
|
||||||
24
docker-compose.yml
Normal file
24
docker-compose.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
services:
|
||||||
|
# Run with: docker compose run --rm linux-snow-export
|
||||||
|
linux-snow-export:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
target: export
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
ver="Snow-v${SNOW_VERSION}-linux-x64"
|
||||||
|
mkdir -p "/output/release/$$ver/bin"
|
||||||
|
cp /export/Snow "/output/release/$$ver/bin/"
|
||||||
|
if [ -d /export/lib ]; then
|
||||||
|
mkdir -p "/output/release/$$ver/lib"
|
||||||
|
cp -a /export/lib/. "/output/release/$$ver/lib/"
|
||||||
|
fi
|
||||||
|
tar -C /output/release -czf "/output/release/$$ver.tgz" "$$ver"
|
||||||
|
volumes:
|
||||||
|
- ./target:/output
|
||||||
|
- ./lib:/export/lib:ro
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
@ -76,8 +76,8 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import:Math
|
import:Math
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
Math.factorial(6L,1L)
|
Math.factorial(6L,1L)
|
||||||
|
|
||||||
@ -90,10 +90,10 @@ end module
|
|||||||
## 源代码 (test.snow)
|
## 源代码 (test.snow)
|
||||||
module: Math
|
module: Math
|
||||||
function: factorial
|
function: factorial
|
||||||
parameter:
|
params:
|
||||||
declare n1: long
|
declare n1: long
|
||||||
declare n2: long
|
declare n2: long
|
||||||
return_type: long
|
returns: long
|
||||||
body:
|
body:
|
||||||
return n1+n2
|
return n1+n2
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
```snow
|
```snow
|
||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
|
|
||||||
return 1 + 1
|
return 1 + 1
|
||||||
@ -57,10 +57,8 @@ bool 类型:
|
|||||||
|---------|----|
|
|---------|----|
|
||||||
| b、B | 7b |
|
| b、B | 7b |
|
||||||
| s、S | 7s |
|
| s、S | 7s |
|
||||||
| i、I | 7i |
|
|
||||||
| l、L | 7l |
|
| l、L | 7l |
|
||||||
| f、F | 7f |
|
| f、F | 7f |
|
||||||
| d、D | 7d |
|
|
||||||
|
|
||||||
|
|
||||||
### 变量
|
### 变量
|
||||||
@ -116,7 +114,7 @@ cond 可以是表达式(结果为 bool 类型)或者 bool 字面量
|
|||||||
```snow
|
```snow
|
||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
if 5 > 7 then
|
if 5 > 7 then
|
||||||
return 5
|
return 5
|
||||||
@ -154,7 +152,7 @@ end loop
|
|||||||
```snow
|
```snow
|
||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare sum: int = 0
|
declare sum: int = 0
|
||||||
loop:
|
loop:
|
||||||
@ -179,17 +177,17 @@ end module
|
|||||||
函数的形式如下:
|
函数的形式如下:
|
||||||
```snow
|
```snow
|
||||||
function: add
|
function: add
|
||||||
parameter:
|
params:
|
||||||
declare a: int
|
declare a: int
|
||||||
declare b: int
|
declare b: int
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return a + b
|
return a + b
|
||||||
end body
|
end body
|
||||||
end function
|
end function
|
||||||
```
|
```
|
||||||
其中 add 是函数名,parameter 下面是参数列表(可省略),与变量的定义类似,但是不允许赋初值,
|
其中 add 是函数名,params 下面是参数列表(可省略),与变量的定义类似,但是不允许赋初值,
|
||||||
接着 return_type 设置返回值类型,最后的 body 为函数体。
|
接着 returns 设置返回值类型,最后的 body 为函数体。
|
||||||
|
|
||||||
## 模块
|
## 模块
|
||||||
|
|
||||||
@ -202,7 +200,7 @@ snow 会自动将同名模块的函数合并。
|
|||||||
```snow
|
```snow
|
||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
|
|
||||||
return 1 + 1
|
return 1 + 1
|
||||||
@ -218,10 +216,10 @@ end module
|
|||||||
// Math.snow
|
// Math.snow
|
||||||
module: Math
|
module: Math
|
||||||
function: add
|
function: add
|
||||||
parameter:
|
params:
|
||||||
declare a: int
|
declare a: int
|
||||||
declare b: int
|
declare b: int
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return a + b
|
return a + b
|
||||||
end body
|
end body
|
||||||
@ -235,7 +233,7 @@ end module
|
|||||||
module: Main
|
module: Main
|
||||||
import: Math
|
import: Math
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
|
|
||||||
return Math.add(5, 7)
|
return Math.add(5, 7)
|
||||||
@ -250,7 +248,7 @@ end module
|
|||||||
module: Main
|
module: Main
|
||||||
import: Math, Time
|
import: Math, Time
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
|
|
||||||
return Math.add(5, 7)
|
return Math.add(5, 7)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Math
|
module: Math
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
Math.factorial(6)
|
Math.factorial(6)
|
||||||
return 0
|
return 0
|
||||||
@ -9,9 +9,9 @@ module: Math
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function: factorial
|
function: factorial
|
||||||
parameter:
|
params:
|
||||||
declare n:int
|
declare n:int
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare num1:int = 1
|
declare num1:int = 1
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
loop:
|
loop:
|
||||||
init:
|
init:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
declare abc:int =1
|
declare abc:int =1
|
||||||
end body
|
end body
|
||||||
|
|||||||
33
playground/BugFarm/Bug2/Main.snow
Normal file
33
playground/BugFarm/Bug2/Main.snow
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare outer_i: int = 1
|
||||||
|
cond:
|
||||||
|
outer_i <= 10
|
||||||
|
step:
|
||||||
|
outer_i = outer_i + 1
|
||||||
|
body:
|
||||||
|
print(outer_i)
|
||||||
|
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
// 注意这一行使用了外层循环的变量 outer_i
|
||||||
|
declare inter_j: int = outer_i
|
||||||
|
cond:
|
||||||
|
inter_j <= 10
|
||||||
|
step:
|
||||||
|
inter_j = inter_j + 1
|
||||||
|
body:
|
||||||
|
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/BugFarm/Bug2/OS.snow
Normal file
11
playground/BugFarm/Bug2/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
14
playground/BugFarm/Bug3/Main.snow
Normal file
14
playground/BugFarm/Bug3/Main.snow
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
// 合法
|
||||||
|
declare b1: byte = 127b
|
||||||
|
declare s1: short = 32767s
|
||||||
|
declare i1: int = 2147483647
|
||||||
|
declare l1: long = 9223372036854775807L
|
||||||
|
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/BugFarm/Bug3/OS.snow
Normal file
11
playground/BugFarm/Bug3/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
9
playground/BugFarm/Bug4/Main.snow
Normal file
9
playground/BugFarm/Bug4/Main.snow
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module: Main
|
||||||
|
import: ModuleB
|
||||||
|
function: main
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
return ModuleB.fun()
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
8
playground/BugFarm/Bug4/a.snow
Normal file
8
playground/BugFarm/Bug4/a.snow
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module: ModuleA
|
||||||
|
function: fun
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
return 123
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
9
playground/BugFarm/Bug4/b.snow
Normal file
9
playground/BugFarm/Bug4/b.snow
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module: ModuleB
|
||||||
|
import: ModuleA
|
||||||
|
function: fun
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
return ModuleA.fun() + ModuleA.fun()
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
16
playground/BugFarm/Bug5/Main.snow
Normal file
16
playground/BugFarm/Bug5/Main.snow
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
globals:
|
||||||
|
declare sum: int = 0
|
||||||
|
function: main
|
||||||
|
params:
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
sum = 20
|
||||||
|
|
||||||
|
os.print(sum)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/BugFarm/Bug5/OS.snow
Normal file
11
playground/BugFarm/Bug5/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
13
playground/BugFarm/Bug6/Main.snow
Normal file
13
playground/BugFarm/Bug6/Main.snow
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
globals:
|
||||||
|
declare sum: int = 123
|
||||||
|
function: main
|
||||||
|
params:
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
os.print(sum)
|
||||||
|
return 0
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/BugFarm/Bug6/OS.snow
Normal file
11
playground/BugFarm/Bug6/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import:Math
|
import:Math
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
Math.add(6,1)
|
Math.add(6,1)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: Math
|
module: Math
|
||||||
function: add
|
function: add
|
||||||
parameter:
|
params:
|
||||||
declare n1: int
|
declare n1: int
|
||||||
declare n2: int
|
declare n2: int
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return n1 + n2
|
return n1 + n2
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare res: boolean = 8L > 7L
|
declare res: boolean = 8L > 7L
|
||||||
if res then
|
if res then
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return 65537
|
return 65537
|
||||||
end body
|
end body
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
foo()
|
foo()
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ module: Main
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function: foo
|
function: foo
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
if false then
|
if false then
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
5 == 7
|
5 == 7
|
||||||
5 == 7s
|
5 == 7s
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
module: Main
|
module: Main
|
||||||
import: os
|
import: os
|
||||||
function: main
|
function: main
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
print(222)
|
os.print(222)
|
||||||
end body
|
end body
|
||||||
end function
|
end function
|
||||||
end module
|
end module
|
||||||
@ -1,9 +1,9 @@
|
|||||||
module: os
|
module: os
|
||||||
import: os
|
import: os
|
||||||
function: print
|
function: print
|
||||||
parameter:
|
params:
|
||||||
declare i1: int
|
declare i1: int
|
||||||
return_type: void
|
returns: void
|
||||||
body:
|
body:
|
||||||
syscall("PRINT",i1)
|
syscall("PRINT",i1)
|
||||||
end body
|
end body
|
||||||
|
|||||||
20
playground/Demo/Demo15/Main.snow
Normal file
20
playground/Demo/Demo15/Main.snow
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
globals:
|
||||||
|
declare num2:int=10
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
declare num1:int=11
|
||||||
|
os.print(num1+num2+abc())
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
|
||||||
|
function: abc
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
return 1
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo15/OS.snow
Normal file
11
playground/Demo/Demo15/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
22
playground/Demo/Demo16/Main.snow
Normal file
22
playground/Demo/Demo16/Main.snow
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare i:int = 1
|
||||||
|
cond:
|
||||||
|
i <= 10
|
||||||
|
step:
|
||||||
|
i = i + 1
|
||||||
|
body:
|
||||||
|
if i % 2 == 0 then
|
||||||
|
os.print(i)
|
||||||
|
end if
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
return 0
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo16/OS.snow
Normal file
11
playground/Demo/Demo16/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
23
playground/Demo/Demo17/Main.snow
Normal file
23
playground/Demo/Demo17/Main.snow
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare i:int = 1
|
||||||
|
cond:
|
||||||
|
i <= 10
|
||||||
|
step:
|
||||||
|
i = i + 1
|
||||||
|
body:
|
||||||
|
if i % 2 == 0 then
|
||||||
|
os.print(i)
|
||||||
|
break
|
||||||
|
end if
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
return 0
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo17/OS.snow
Normal file
11
playground/Demo/Demo17/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
43
playground/Demo/Demo18/Main.snow
Normal file
43
playground/Demo/Demo18/Main.snow
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare i:int = 1
|
||||||
|
cond:
|
||||||
|
i <= 5
|
||||||
|
step:
|
||||||
|
i = i + 1
|
||||||
|
body:
|
||||||
|
if i % 2 == 0 then
|
||||||
|
continue
|
||||||
|
end if
|
||||||
|
if i > 3 then
|
||||||
|
break
|
||||||
|
end if
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare j:int = 1
|
||||||
|
cond:
|
||||||
|
j <= 5
|
||||||
|
step:
|
||||||
|
j = j + 1
|
||||||
|
body:
|
||||||
|
if j == 4 then
|
||||||
|
break
|
||||||
|
end if
|
||||||
|
if j % 2 == 0 then
|
||||||
|
continue
|
||||||
|
end if
|
||||||
|
os.print(i)
|
||||||
|
os.print(j)
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
return 0
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo18/OS.snow
Normal file
11
playground/Demo/Demo18/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
26
playground/Demo/Demo19/Main.snow
Normal file
26
playground/Demo/Demo19/Main.snow
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
declare n: int[][][][] = [
|
||||||
|
[
|
||||||
|
[ [17, 18], [19, 20] ],
|
||||||
|
[ [21, 22], [23, 24] ]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[ [25, 26], [27, 28] ],
|
||||||
|
[ [29, 30], [31, 32] ]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
declare i: int = 0
|
||||||
|
declare j: int = 1
|
||||||
|
declare k: int = 0
|
||||||
|
declare l: int = 0
|
||||||
|
|
||||||
|
declare x: int = n[i][j][k][l]
|
||||||
|
os.print(x)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo19/OS.snow
Normal file
11
playground/Demo/Demo19/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
return (1+2) / 3 * 4 + 2 *2
|
return (1+2) / 3 * 4 + 2 *2
|
||||||
end body
|
end body
|
||||||
|
|||||||
12
playground/Demo/Demo20/Main.snow
Normal file
12
playground/Demo/Demo20/Main.snow
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
module: Main
|
||||||
|
import:os
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
declare arr: int[] = [1, 2, 3]
|
||||||
|
arr[0] = 5
|
||||||
|
|
||||||
|
os.print(arr[0])
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo20/OS.snow
Normal file
11
playground/Demo/Demo20/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
35
playground/Demo/Demo21/Main.snow
Normal file
35
playground/Demo/Demo21/Main.snow
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
globals:
|
||||||
|
declare sum: int = 123
|
||||||
|
function: main
|
||||||
|
params:
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
declare arr: int[][][][][][][][][][][][][][][][][][][][][][] = [[[[[[[[[[[[[[[[[[[[[[1], [2], [3]]]]]]]]]]]]]]]]]]]]]]
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare i: int = 0
|
||||||
|
cond:
|
||||||
|
i < 3
|
||||||
|
step:
|
||||||
|
i = i + 1
|
||||||
|
body:
|
||||||
|
arr[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][i][0] = arr[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][i][0] + 1
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
loop:
|
||||||
|
init:
|
||||||
|
declare i: int = 0
|
||||||
|
cond:
|
||||||
|
i < 3
|
||||||
|
step:
|
||||||
|
i = i + 1
|
||||||
|
body:
|
||||||
|
os.print(arr[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][i][0])
|
||||||
|
end body
|
||||||
|
end loop
|
||||||
|
return 0
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo21/OS.snow
Normal file
11
playground/Demo/Demo21/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
15
playground/Demo/Demo22/Main.snow
Normal file
15
playground/Demo/Demo22/Main.snow
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module: Main
|
||||||
|
import: ModuleA,os
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
declare sum: int = ModuleA.a+2
|
||||||
|
os.print(sum+1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
|
|
||||||
|
module: ModuleA
|
||||||
|
globals:
|
||||||
|
declare const a: int =10
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo22/OS.snow
Normal file
11
playground/Demo/Demo22/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
14
playground/Demo/Demo23/Main.snow
Normal file
14
playground/Demo/Demo23/Main.snow
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module: Main
|
||||||
|
import: ModuleA
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
declare sum: byte = ModuleA.a
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
|
|
||||||
|
module: ModuleA
|
||||||
|
globals:
|
||||||
|
declare const a: byte = 2b
|
||||||
|
end module
|
||||||
26
playground/Demo/Demo24/Main.snow
Normal file
26
playground/Demo/Demo24/Main.snow
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
module: Main
|
||||||
|
import: ModuleA,os
|
||||||
|
globals:
|
||||||
|
declare const c: int = 10
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
declare a: int = ModuleA.sum(c,2)
|
||||||
|
os.print(a)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
|
|
||||||
|
module: ModuleA
|
||||||
|
globals:
|
||||||
|
declare const a: int = 10
|
||||||
|
function: sum
|
||||||
|
params:
|
||||||
|
declare a: int
|
||||||
|
declare b: int
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
return a + b
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo24/OS.snow
Normal file
11
playground/Demo/Demo24/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
23
playground/Demo/Demo25/Main.snow
Normal file
23
playground/Demo/Demo25/Main.snow
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
module: Main
|
||||||
|
import: os,ModuleA
|
||||||
|
globals:
|
||||||
|
declare c: int = 10
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
c = ModuleA.getA()
|
||||||
|
os.print(c)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
|
|
||||||
|
module: ModuleA
|
||||||
|
globals:
|
||||||
|
declare a: int = 2
|
||||||
|
function: getA
|
||||||
|
returns: int
|
||||||
|
body:
|
||||||
|
return a
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/Demo/Demo25/OS.snow
Normal file
11
playground/Demo/Demo25/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
params:
|
||||||
|
declare i1: int
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
20
playground/Demo/Demo26/Main.snow
Normal file
20
playground/Demo/Demo26/Main.snow
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
module: Main
|
||||||
|
function: main
|
||||||
|
returns: void
|
||||||
|
body:
|
||||||
|
// 1. 常见转义符
|
||||||
|
declare sNewline : string = "换行示例:\n第二行"
|
||||||
|
declare sTab : string = "制表符示例:\t列二"
|
||||||
|
declare sBackslash: string = "反斜杠示例: C:\\Snow"
|
||||||
|
declare sDQuote : string = "双引号示例: \"Snow\""
|
||||||
|
declare sSQuote : string = "单引号示例: \'Snow\'"
|
||||||
|
declare sCarriage : string = "回车示例:\rCarriage"
|
||||||
|
declare sBackspace: string = "退格示例: ABC\bD"
|
||||||
|
declare sFormFeed : string = "换页示例:\fPage-2"
|
||||||
|
|
||||||
|
// 2. Unicode 转义
|
||||||
|
declare sUnicode : string = "𪚥𠮷: \u4F60\u597D, Snow!"
|
||||||
|
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare n1: int =1
|
declare n1: int =1
|
||||||
declare n2: int =2
|
declare n2: int =2
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: boolean
|
returns: boolean
|
||||||
body:
|
body:
|
||||||
declare b1: boolean =true
|
declare b1: boolean =true
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare b1: boolean = true
|
declare b1: boolean = true
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
module: Main
|
module: Main
|
||||||
function: main
|
function: main
|
||||||
parameter:
|
params:
|
||||||
return_type: int
|
returns: int
|
||||||
body:
|
body:
|
||||||
declare b1 :int = -1
|
declare b1 :int = -1
|
||||||
return b1
|
return b1
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user