File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55Resources
66
77* [ Documentation] ( https://www.kcl-lang.io )
8+ * [ KCL Tour] ( https://www.kcl-lang.io/docs/reference/lang/tour )
89* [ KCL extension] ( https://marketplace.visualstudio.com/items?itemName=kcl.kcl-vscode-extension ) for Visual Studio Code
910
1011``` sh
@@ -15,6 +16,8 @@ brew install kcl-lang/tap/kcl
1516## Examples
1617
1718``` sh
18- # execute program
19+ # execute program and output yaml
1920kcl kcl/hello.k
21+ kcl kcl/server-1.k
22+ kcl kcl/server-2.k
2023```
Original file line number Diff line number Diff line change 1+ # This is a KCL document
2+
3+ # attribute
4+ title = "KCL Example"
5+
6+ # dictionary
7+ owner = {
8+ name = "The KCL Authors"
9+ data = "2020-01-02T03:04:05"
10+ }
11+
12+ database = {
13+ enabled = True
14+ ports = [8000 , 8001 , 8002 ]
15+ data = [["delta" , "phi" ], [3.14 ]]
16+ temp_targets = {cpu = 79.5 , case = 72.0 }
17+ }
18+
19+ # list with dictionaries
20+ servers = [
21+ {ip = "10.0.0.1" , role = "frontend" }
22+ {ip = "10.0.0.2" , role = "backend" }
23+ ]
Original file line number Diff line number Diff line change 1+ # default configuration
2+ schema DatabaseConfig:
3+ enable: bool = True
4+ ports: [int ] = [8000 , 8001 , 8002 ]
5+ data: [[str |float ]] = [["delta" , "phi" ], [3.14 ]]
6+ temp_targets: {str : float } = {cpu = 79.5 , case = 72.0 }
7+
8+ schema ServerConfig:
9+ # required when no default value
10+ ip: str
11+ # enumeration
12+ role: "frontend" | "backend"
13+
14+ # unique name
15+ databaseNew = DatabaseConfig {
16+ ports = [2020 , 2021 ]
17+ }
18+
19+ serversNew = [
20+ ServerConfig {ip = "10.0.0.1" , role = "frontend" }
21+ ServerConfig {ip = "10.0.0.2" , role = "backend" }
22+ ]
You can’t perform that action at this time.
0 commit comments