BCC Programming Language

简单、优雅、现代的编程语言 / Simple, Elegant, Modern Programming Language

核心特性 / Core Features

🎨

简洁的语法

清晰直观的语法设计,易于学习和使用


x = 5
if(x > 3) {
    print("Hello, BCC!")
}
                    
🔧

函数支持

支持公共和私有函数定义


def public add(x, y) {
    return x + y
}
                    
📦

代码块

强大的代码块功能


forEach {
    print("Inside block")
}
                    

文档 / Documentation

简略文档

📚 完整文档

基本语法


// 变量赋值
x = 5
y = "Hello"

// 算术运算
sum = x + 10
product = x * 2

// 打印
print("结果是: ")
printnln(sum)  // 不换行打印
                            

控制流


// if 语句
if(x > 0) {
    print("x是正数")
}

// while 循环
while(x < 10) {
    print(x)
    x = x + 1
}

// for 循环
for(i = 0, i < 5, i = i + 1) {
    print(i)
}
                            

函数


// 公共函数定义
def public add(x, y) {
    return x + y
}

// 私有函数定义
def private helper() {
    print("辅助函数")
}

// 带代码块参数的函数
def public forEach(block: BCC.Codeblock) {
    block.execute()
}
                            

模块系统


// 导入模块
import "basicDef.bcm"

// 使用模块中的函数
result = max(5, 3)
print(result)
                            

代码块


// 基本代码块
forEach {
    print("代码块内容")
}

// 带条件的代码块
while(x < 3) {
    print(x)
    x = x + 1
}
                            

示例 / Examples

基础计算器


def public add(x, y) {
    return x + y
}

def public multiply(x, y) {
    return x * y
}

result = add(5, multiply(3, 2))
print("结果: ")
print(result)
                            

代码块示例


forEach {
    print("第一行")
    print("第二行")
    print("第三行")
}
                        

快速开始 / Quick Start

1

下载 BCC

下载并解压 BCC 压缩包

下载最新版本
2

安装 VSCode 扩展

在 VSCode 扩展市场搜索 "BCC"

或者下载对应的vsix文件

3

创建文件

创建 .bcs 文件开始编码

4

运行程序

使用 BCC 解释器运行代码