Giter Club home page Giter Club logo

kotlin2018 / kclvm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kusionstack/kcl

0.0 0.0 0.0 3.6 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.59% C++ 6.99% C 19.71% Go 1.06% Rust 69.55% Makefile 0.38% NSIS 0.03% LLVM 1.12% AMPL 0.01% Batchfile 0.10% Dockerfile 0.22% SWIG 0.24% Fluent 0.01%

kclvm's Introduction

KCL

license Continuous Integration

δΈ­ζ–‡

Kusion Configuration Language (KCL) is an open source configuration language mainly used in Kusion Stack. KCL is a statically typed language for configuration and policy scenarios, based on concepts such as declarative and Object-Oriented Programming (OOP) paradigms.

Core Features

  • 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: reuse common programming language ecology.
    • OpenAPI model support: 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.

Installing & Documentation

How to install

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

Quick Showcase

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

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

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 https://kusionstack.io

Developing & Contributing

Developing

See Developing Guide.

Roadmap

See KCLVM Roadmap

License

Apache License Version 2.0

kclvm's People

Contributors

chai2010 avatar he1pa avatar ldxdl avatar neverrar avatar peefy 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.