Skip to content

Commit dfdc8f6

Browse files
authored
Merge pull request #52 from qianmoQ/dev-25.0.3
feat (language): 支持 R 和 Cangjie 语言
2 parents 40e6742 + 9feb61c commit dfdc8f6

File tree

10 files changed

+591
-0
lines changed

10 files changed

+591
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发
2424

2525
<div style="display: flex; align-items: center; justify-content: center;">
2626
<img src="public/icons/c.svg" width="60" alt="C">
27+
<img src="public/icons/cangjie.svg" width="60" alt="Cangjie">
2728
<img src="public/icons/clojure.svg" width="60" alt="Clojure">
2829
<img src="public/icons/cpp.svg" width="60" alt="C++">
2930
<img src="public/icons/css.svg" width="60" alt="CSS">
@@ -39,6 +40,7 @@ CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发
3940
<img src="public/icons/php.svg" width="60" alt="PHP">
4041
<img src="public/icons/python.svg" width="60" alt="Python 2">
4142
<img src="public/icons/python.svg" width="60" alt="Python 3">
43+
<img src="public/icons/r.svg" width="60" alt="R">
4244
<img src="public/icons/ruby.svg" width="60" alt="Ruby">
4345
<img src="public/icons/rust.svg" width="60" alt="Rust">
4446
<img src="public/icons/shell.svg" width="60" alt="Shell">

public/icons/cangjie.svg

Lines changed: 5 additions & 0 deletions
Loading

public/icons/r.svg

Lines changed: 14 additions & 0 deletions
Loading

src-tauri/src/examples/cangjie.cj

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// 仓颉示例代码 - CodeForge 代码执行环境
2+
3+
main(): Unit {
4+
println("🎉 欢迎使用 CodeForge!")
5+
println("Welcome to CodeForge!")
6+
println("")
7+
8+
println("=========================================")
9+
println(" CodeForge Cangjie ")
10+
println("=========================================")
11+
println("")
12+
13+
// 基本输出示例
14+
println("✅ 仓颉运行成功! (Cangjie is working!)")
15+
println("⚡ 这是仓颉程序 (This is Cangjie program)")
16+
println("")
17+
18+
// 变量操作
19+
let name = "CodeForge"
20+
let version = "Cangjie"
21+
let number1 = 10
22+
let number2 = 20
23+
let result = number1 + number2
24+
25+
println("🔢 简单计算 (Simple calculation):")
26+
println("${number1} + ${number2} = ${result}")
27+
println("")
28+
29+
// 字符串操作和插值
30+
println("📝 字符串操作 (String operations):")
31+
println("平台名称 (Platform): ${name}")
32+
println("语言版本 (Language): ${version}")
33+
println("完整信息 (Full info): ${name} - ${version}")
34+
println("")
35+
36+
// 数组操作
37+
println("🍎 数组示例 (Array example):")
38+
let fruits = ["苹果", "香蕉", "橙子", "葡萄"]
39+
for (i in 0..fruits.size) {
40+
println("${i + 1}. ${fruits[i]}")
41+
}
42+
println("")
43+
44+
// 条件判断
45+
let score = 85
46+
println("📊 成绩评估 (Score evaluation):")
47+
if (score >= 90) {
48+
println("优秀! (Excellent!)")
49+
} else if (score >= 80) {
50+
println("良好! (Good!)")
51+
} else if (score >= 60) {
52+
println("及格 (Pass)")
53+
} else {
54+
println("需要努力 (Need improvement)")
55+
}
56+
println("")
57+
58+
// 循环示例
59+
println("🔄 循环输出 (Loop output):")
60+
for (i in 1..6) {
61+
println("第 ${i} 次输出 (Output #${i}): Hello from CodeForge!")
62+
}
63+
println("")
64+
65+
// while循环示例
66+
println("🔁 While循环示例 (While loop example):")
67+
var counter = 1
68+
while (counter <= 3) {
69+
println("While循环: 第 ${counter} 次")
70+
counter += 1
71+
}
72+
println("")
73+
74+
println("🎯 CodeForge 仓颉代码执行完成!")
75+
println("🎯 CodeForge Cangjie execution completed!")
76+
println("")
77+
println("感谢使用 CodeForge 代码执行环境! 🚀")
78+
println("Thank you for using CodeForge! 🚀")
79+
}

0 commit comments

Comments
 (0)