-
Notifications
You must be signed in to change notification settings - Fork 119
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
5 changed files
with
160 additions
and
143 deletions.
There are no files selected for viewing
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,11 @@ | ||
name: KCL | ||
on: ["push", "pull_request"] | ||
jobs: | ||
build: | ||
# Ref: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'true' |
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,94 @@ | ||
<h1 align="center">KCL: Constraint-based Record & Functional Language</h1> | ||
|
||
<p align="center"> | ||
<a href="./README.md">English</a> | <a href="./README-zh.md">简体中文</a> | ||
</p> | ||
<p align="center"> | ||
<a href="#介绍">介绍</a> | <a href="#特性">特性</a> | <a href="#场景">场景</a> | <a href="#安装">安装</a> | <a href="#快速开始">快速开始</a> | <a href="#文档">文档</a> | <a href="#贡献">贡献</a> | <a href="#路线规划">路线规划</a> | ||
</p> | ||
|
||
<p align="center"> | ||
<img src="https://github.com/KusionStack/KCLVM/workflows/KCL/badge.svg"> | ||
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square"> | ||
<img src="https://coveralls.io/repos/github/KusionStack/KCLVM/badge.svg"> | ||
<img src="https://img.shields.io/github/release/KusionStack/KCLVM.svg"> | ||
<img src="https://img.shields.io/github/license/KusionStack/KCLVM.svg"> | ||
</p> | ||
|
||
## 介绍 | ||
|
||
Kusion 配置语言(KCL)是一个开源的基于约束的记录及函数语言。KCL 通过成熟的编程语言技术和实践来改进对大量繁杂配置的编写,致力于构建围绕配置的更好的模块化、扩展性和稳定性,更简单的逻辑编写,以及更快的自动化集成和良好的生态延展性。 | ||
|
||
## 特性 | ||
|
||
+ **简单易用**:源于 Python、Golang 等高级语言,采纳函数式编程语言特性,低副作用 | ||
+ **设计良好**:独立的 Spec 驱动的语法、语义、运行时和系统库设计 | ||
+ **快速建模**:以 [Schema](https://kusionstack.io/docs/reference/lang/lang/tour#schema) 为中心的配置类型及模块化抽象 | ||
+ **功能完备**:基于 [Config](https://kusionstack.io/docs/reference/lang/lang/codelab/simple)、[Schema](https://kusionstack.io/docs/reference/lang/lang/tour/#schema)、[Lambda](https://kusionstack.io/docs/reference/lang/lang/tour/#%E5%87%BD%E6%95%B0)、[Rule](https://kusionstack.io/docs/reference/lang/lang/tour/#rule) 的配置及其模型、逻辑和策略编写 | ||
+ **可靠稳定**:依赖[静态类型系统](https://kusionstack.io/docs/reference/lang/lang/tour#%E7%B1%BB%E5%9E%8B%E7%B3%BB%E7%BB%9F)、约束和[自定义规则](https://kusionstack.io/docs/reference/lang/lang/tour#rule)的配置稳定性 | ||
+ **强可扩展**:通过独立配置块[自动合并机制](https://kusionstack.io/docs/reference/lang/lang/tour#%E9%85%8D%E7%BD%AE%E6%93%8D%E4%BD%9C)保证配置编写的高可扩展性 | ||
+ **易自动化**:[CRUD APIs](https://kusionstack.io/docs/reference/lang/lang/tour#kcl-%E5%8F%98%E9%87%8F%E4%BF%AE%E6%94%B9),[多语言 SDK](https://kusionstack.io/docs/reference/lang/xlang-api/overview),[语言插件](https://github.com/KusionStack/kcl-plugin) 构成的梯度自动化方案 | ||
+ **极致性能**:使用 Rust & C,[LLVM](https://llvm.org/) 实现,支持编译到本地代码和 [WASM](https://webassembly.org/) 的高性能编译时和运行时 | ||
+ **API 亲和**:原生支持 [OpenAPI](https://github.com/KusionStack/kcl-openapi)、 Kubernetes CRD, Kubernetes YAML 等 API 生态规范 | ||
+ **开发友好**:[语言工具](https://kusionstack.io/docs/reference/cli/kcl/) (Format,Lint,Test,Vet,Doc 等)、 [IDE 插件](https://github.com/KusionStack/vscode-kcl) 构建良好的研发体验 | ||
+ **安全可控**:面向领域,不原生提供线程、IO 等系统级功能,低噪音,低安全风险,易维护,易治理 | ||
|
||
## 场景 | ||
|
||
您可以将 KCL 用于 | ||
|
||
+ 生成静态配置数据如 JSON, YAML 等 | ||
+ 使用 schema 对配置数据进行建模并减少配置数据中的样板文件 | ||
+ 为配置数据定义带有规则约束的 schema 并对数据进行自动验证 | ||
+ 分块编写配置数据并使用不同的策略合并数据 | ||
+ 无副作用地组织、简化、统一和管理庞大的配置 | ||
+ 与 [Kusion Stack](https://kusionstack.io) 一起,定义您的应用交付运维生态 | ||
|
||
## 安装 | ||
|
||
从 Github releases 页面[下载](https://github.com/KusionStack/KCLVM/releases),并且将 `{install-location}/kclvm/bin` 添加到您的环境变量中 | ||
|
||
## 快速开始 | ||
|
||
`./samples/fib.k` 是一个计算斐波那契数列的例子 | ||
|
||
```kcl | ||
schema Fib: | ||
n1 = n - 1 | ||
n2 = n1 - 1 | ||
n: int | ||
value: int | ||
if n <= 1: | ||
value = 1 | ||
elif n == 2: | ||
value = 1 | ||
else: | ||
value = Fib {n = n1}.value + Fib {n = n2}.value | ||
fib8 = Fib {n = 8}.value | ||
``` | ||
|
||
我们可以通过执行如下命令得到 YAML 输出 | ||
|
||
``` | ||
kcl ./samples/fib.k | ||
``` | ||
|
||
YAML 输出 | ||
|
||
```yaml | ||
fib8: 21 | ||
``` | ||
## 文档 | ||
更多文档请访问[语言手册](https://kusionstack.io/docs/reference/lang/lang/tour) | ||
## 贡献 | ||
参考[开发手册](./docs/dev_guide/1.about_this_guide.md). | ||
## 路线规划 | ||
参考[KCLVM 路线规划](https://kusionstack.io/docs/governance/intro/roadmap#kclvm-%E8%B7%AF%E7%BA%BF%E8%A7%84%E5%88%92) |
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 was deleted.
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