Skip to content

Commit

Permalink
docs: update KCLVM readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peefy committed Sep 5, 2022
1 parent 2b09b19 commit 9918e0c
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 131 deletions.
102 changes: 102 additions & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<h1 align="center">KCLVM</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> | <a href="#许可">许可</a>
</p>

<p align="center">
<img src="https://img.shields.io/github/release/KusionStack/KCLVM.svg">
<img src="https://img.shields.io/badge/Rust-1.60-blue.svg">
<img src="https://coveralls.io/repos/github/KusionStack/KCLVM/badge.svg">
<img src="https://img.shields.io/github/license/KusionStack/KCLVM.svg">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square">
</p>

<p align="center">
<img src="https://github.com/KusionStack/KCLVM/actions/workflows/ubuntu_test.yaml/badge.svg">
<img src="https://github.com/KusionStack/KCLVM/actions/workflows/macos_test.yaml/badge.svg">
<img src="https://github.com/KusionStack/KCLVM/actions/workflows/windows_test.yaml/badge.svg">
</p>

## 介绍

Kusion 配置语言(KCL)是一个开源的基于约束的记录及函数语言。KCL 通过成熟的编程语言理论和实践来改进对大量繁杂的配置数据和逻辑的编写,通过声明式的语法结合静态类型等技术特性来简化和校验配置的开发和运维工作。

## 特性

+ **设计优良**:独立设计的语法、语义、运行时和系统库,提供[配置(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)等核心语言元素
+ **建模能力**:以 [Schema](https://kusionstack.io/docs/reference/lang/lang/tour#schema) 为中心的建模抽象
+ **使用简单**:语言自身覆盖大多数配置和策略功能
+ **可靠**[静态类型系统](https://kusionstack.io/docs/reference/lang/lang/tour#%E7%B1%BB%E5%9E%8B%E7%B3%BB%E7%BB%9F)[自定义 Rule 规则约束](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)[多语言 APIs](https://kusionstack.io/docs/reference/lang/xlang-api/overview)
+ **高性能**:语言编译器本身主要采用 Rust & C 实现,配合 [LLVM](https://llvm.org/) 优化器,支持编译到本地代码和 [WASM](https://webassembly.org/https://webassembly.org/) 等目标并高效执行
+ **云原生亲和**:原生支持 [OpenAPI](https://github.com/KusionStack/kcl-openapi) 和 Kubernetes CRD Specs 到 KCL 的转换,支持 Kubernetes YAML 规范
+ **开发友好**:丰富的[语言工具](https://kusionstack.io/docs/reference/cli/kcl/) (Format,Lint,Test,Vet,Doc 等)、 [IDE 插件](https://github.com/KusionStack/vscode-kcl)[语言插件](https://github.com/KusionStack/kcl-plugin)

## 场景

您可以将 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: int = n - 1
n2: int = 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/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)
## 许可
[Apache License Version 2.0](./LICENSE)
91 changes: 51 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,58 @@
# KCL
<h1 align="center">KCLVM</h1>

![license](https://img.shields.io/badge/license-Apache--2.0-green.svg)
[![Continuous Integration](https://github.com/KusionStack/KCLVM/actions/workflows/github-actions.yaml/badge.svg)](https://github.com/KusionStack/KCLVM/actions?query=branch%3Amain)
<p align="center">
<a href="./README.md">English</a> | <a href="./README-zh.md">简体中文</a>
</p>
<p align="center">
<a href="#introduction">Introduction</a> | <a href="#features">Features</a> | <a href="#features">Features</a> | <a href="#installation">Installation</a> | <a href="#what-is-it-for">What is it for</a> | <a href="#documentation">Documentation</a> | <a href="#contributing">Contributing</a> | <a href="#roadmap">Roadmap</a> | <a href="#license">License</a>
</p>

[中文](./README_ZH.md)
<p align="center">
<img src="https://img.shields.io/github/release/KusionStack/KCLVM.svg">
<img src="https://img.shields.io/badge/Rust-1.60-blue.svg">
<img src="https://coveralls.io/repos/github/KusionStack/KCLVM/badge.svg">
<img src="https://img.shields.io/github/license/KusionStack/KCLVM.svg">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square">
</p>

Kusion Configuration Language (KCL) is an open source configuration language mainly used in [Kusion Stack](https://kusionstack.io). KCL is a statically typed language for configuration and policy scenarios, based on concepts such as declarative and Object-Oriented Programming (OOP) paradigms.
<p align="center">
<img src="https://github.com/KusionStack/KCLVM/actions/workflows/ubuntu_test.yaml/badge.svg">
<img src="https://github.com/KusionStack/KCLVM/actions/workflows/macos_test.yaml/badge.svg">
<img src="https://github.com/KusionStack/KCLVM/actions/workflows/windows_test.yaml/badge.svg">
</p>

## Core Features
## Introduction

+ **Simple**
+ Originated from Python and Golang, incorporating functional language features.
+ Absorbs integrated language elements such as statements, expressions, conditions, loops, etc.
+ Type and data separation, schema declaration configuration definition.
+ **Stable**
+ Strong immutable constraint.
+ Compile-time type deduction, type checking.
+ Rule policy definition: attribute-centric constraint expressions, query results based on constraints.
+ Testable: assert, print, and test tools.
+ **Scalable**
+ Configuration unification: compile-time configuration dependency graph substitution.
+ Configuration attribute operators: meet the needs of configuration override, merge, add and delete, etc.
+ Configuration reuse: rich built-in data structures and syntax semantics, easily to expand one configuration of different scenarios.
+ **Engineering**
+ Schema single inheritance and declarative model reuse and assembly.
+ Tool & API granular configuration automation.
+ Rich built-in functions and system libraries.
+ Top-level dynamic data input.
+ Code organization: modules and packages.
+ [Plug-in system](https://github.com/KusionStack/kcl-plugin): reuse common programming language ecology.
+ [OpenAPI model support](https://github.com/KusionStack/kcl-openapi): Swagger and KCL schema bidirectional conversion, Kubernetes CRD conversion to KCL schema.
+ **High Performance**
+ Works with the LLVM optimizer, supports compilation to native code and formats like WASM and executes efficiently.
Kusion Configuration Language (KCL) is an open source constraint-based record & functional language mainly used in [Kusion Stack](https://kusionstack.io). KCL improves the writing of a large number of complicated configuration data and logic through mature programming language theory and practice, and simplifies and verifies the development and operation of configuration through declarative syntax combined with technical features such as static typing.

## Installing & Documentation
## Features

### How to install
+ **Well-designed**: Independently designed syntax, semantics, runtime and system modules, providing core language elements such as [configuration](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) and [rule](https://kusionstack.io/docs/reference/lang/lang/tour/#rule).
+ **Modeling**: [Schema](https://kusionstack.io/docs/reference/lang/lang/tour#schema)-centric modeling abstraction.
+ **Easy to use**: the language itself covers most configuration and policy functions.
+ **Stability**: [Static type system](https://kusionstack.io/docs/reference/lang/lang/tour#%E7%B1%BB%E5%9E%8B%E7%B3%BB%E7%BB%9F) and [custom rule constraints](https://kusionstack.io/docs/reference/lang/lang/tour#rule).
+ **Scalability**: Configuration block definition ability and [rich configuration merge coverage ability](https://kusionstack.io/docs/reference/lang/lang/tour#%E9%85%8D%E7%BD%AE%E6%93%8D%E4%BD%9C).
+ **Automation capabilities**: Rich language-level [CRUD APIs](https://kusionstack.io/docs/reference/lang/lang/tour#kcl-%E5%8F%98%E9%87%8F%E4%BF%AE%E6%94%B9) and [multi-language APIs](https://kusionstack.io/docs/reference/lang/xlang-api/overview).
+ **High performance**: The language compiler is implemented in Rust and C mainly with [LLVM](https://llvm.org/) optimizer, supports compilation to native and [WASM](https://webassembly.org/https://webassembly.org/) targets and executes efficiently.
+ **Cloud Native Affinity**: Native support for [OpenAPI](https://github.com/KusionStack/kcl-openapi) and [Kubernetes CRD Specs](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) to KCL conversion, support for Kubernetes YAML specification.
+ **Development friendly**: Rich [language tools](https://kusionstack.io/docs/reference/cli/kcl/) (Format, Lint, Test, Vet, Doc, etc.), [IDE plugins](https://github.com/KusionStack/vscode-kcl) and [language plugins](https://github.com/KusionStack/kcl-plugin).

[Download](https://github.com/KusionStack/KCLVM/releases) the latest release from GitHub and add `{install-location}/kclvm/bin` to environment PATH.
## What is it for?

### Quick Showcase
You can use KCL to

+ generate low-level configuration data like JSON, YAML, etc.
+ reduce boilerplate in configuration data with the schema modeling.
+ define schemas with rule constraints for configuration data and validate them automatically.
+ write configuration data separately and merge them using different strategies.
+ organize, simplify, unify and manage large configurations without side effects.
+ define your application delivery and operation ecosystem with [Kusion Stack](https://kusionstack.io).

## Installation

[Download](https://github.com/KusionStack/KCLVM/releases) the latest release from GitHub and add `{install-location}/kclvm/bin` to the environment `PATH`.

## Quick Showcase

`./samples/fib.k` is an example of calculating the Fibonacci sequence.

Expand Down Expand Up @@ -72,20 +85,18 @@ YAML output
fib8: 21
```
### Documentation
## Documentation
Detailed documentation is available at https://kusionstack.io
## Developing & Contributing
### Developing
## Contributing
See [Developing Guide](./docs/dev_guide/1.about_this_guide.md).
### Roadmap
## Roadmap
See [KCLVM Roadmap](https://kusionstack.io/docs/governance/intro/roadmap#kclvm-%E8%B7%AF%E7%BA%BF%E8%A7%84%E5%88%92)
See [KCLVM Roadmap](https://kusionstack.io/docs/governance/intro/roadmap#kclvm-%E8%B7%AF%E7%BA%BF%E8%A7%84%E5%88%92).
## License
Apache License Version 2.0
[Apache License Version 2.0](./LICENSE)
91 changes: 0 additions & 91 deletions README_ZH.md

This file was deleted.

0 comments on commit 9918e0c

Please sign in to comment.