Giter Site home page Giter Site logo

kirinse / kclvm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kcl-lang/kcl

0.0 0.0 0.0 4.1 MB

A constraint-based record & functional language mainly used in configuration and policy scenarios.

Home Page: https://kusionstack.io/docs/reference/lang/lang/tour

License: Apache License 2.0

Shell 0.57% C++ 6.76% C 19.04% Go 1.03% Rust 70.55% Makefile 0.40% NSIS 0.03% LLVM 1.08% AMPL 0.01% Batchfile 0.10% Dockerfile 0.21% SWIG 0.23% Fluent 0.01%

kclvm's Introduction

KCL: Constraint-based Record & Functional Language

English | 简体中文

Introduction | Features | What is it for | Installation | Showcase | Documentation | Contributing | Roadmap

Introduction

Kusion Configuration Language (KCL) is an open source constraint-based record and functional language. KCL improves the writing of a large number of complex configurations through mature programming language technology and practice, and is committed to building better modularity, scalability and stability around configuration, simpler logic writing, fast automation and good ecological extensionality.

Features

  • Easy-to-use: Originated from high-level languages ​​such as Python and Golang, incorporating functional language features with low side effects.
  • Well-designed: Independent Spec-driven syntax, semantics, runtime and system modules design.
  • Quick modeling: Schema-centric configuration types and modular abstraction.
  • Rich capabilities: Configuration with type, logic and policy based on Config, Schema, Lambda, Rule.
  • Stability: Configuration stability built on static type system, constraints, and rules.
  • Scalability: High scalability through automatic merge mechanism of isolated config blocks.
  • Fast automation: Gradient automation scheme of CRUD APIs, multilingual SDKs, language plugin
  • High performance: High compile time and runtime performance using Rust & C and LLVM, and support compilation to native code and WASM.
  • API affinity: Native support API ecological specifications such as OpenAPI, Kubernetes CRD, Kubernetes YAML spec.
  • Development friendly: Friendly development experiences with rich language tools (Format, Lint, Test, Vet, Doc, etc.) and IDE plugins.
  • Safety & maintainable: Domain-oriented, no system-level functions such as native threads and IO, low noise and security risk, easy maintenance and governance.
  • Production-ready: Widely used in production practice of platform engineering and automation at Ant Group.

What is it for?

You can use KCL to

  • Generate low-level static 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.
  • Organize, simplify, unify and manage large configurations without side effects.
  • Manage large configurations scalably with isolated configuration blocks.
  • Used as a platform engineering lang to deliver modern app with Kusion Stack.

How to choose?

The simple answer:

  • YAML is recommended if you need to write structured static K-V, or use Kubernetes' native tools
  • HCL is recommended if you want to use programming language convenience to remove boilerplate with good human readability, or if you are already a Terraform user
  • CUE is recommended if you want to use type system to improve stability and maintain scalable configurations
  • KCL is recommended if you want types and modeling like a modern language, scalable configurations, in-house pure functions and rules, and production-ready performance and automation

A detailed feature and scenario comparison will be coming later.

Installation

Download the latest release from GitHub and add {install-location}/kclvm/bin to the environment PATH.

Showcase

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

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

We can execute the following command to get a YAML output.

kcl ./samples/fib.k

YAML output

fib8: 21

Documentation

Detailed documentation is available at KCL tour

Contributing

See Developing Guide.

Roadmap

See KCLVM Roadmap.

Community

See the community for ways to join us.

kclvm's People

Contributors

chai2010 avatar he1pa avatar ldxdl avatar neverrar avatar peefy avatar possible-fqz avatar zong-zhe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.