kin-lang 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +138 -0
- package/dist/app.js +11 -0
- package/dist/kin-cli.js +2 -0
- package/dist/kin.js +7428 -0
- package/dist/kin_std/json.js +14 -0
- package/dist/kin_std/math.js +16 -0
- package/dist/kin_std/time.js +12 -0
- package/dist/lsp/server.js +3425 -0
- package/package.json +64 -0
- package/src/std/console.js +5 -0
- package/src/std/fs.js +26 -0
- package/src/std/http.js +17 -0
- package/src/std/json.js +14 -0
- package/src/std/math.js +16 -0
- package/src/std/time.js +12 -0
- package/src/std/ui.js +173 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kin Language Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Kin Programming Language
|
|
2
|
+
|
|
3
|
+
A beginner-friendly programming language that compiles to **Web (React)**, **Mobile (React Native)**, and **Desktop (Electron)**.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g kin-lang
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it. The `kin` command is now available globally in your terminal.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Create a new web app
|
|
17
|
+
kin init web-app my-app
|
|
18
|
+
|
|
19
|
+
cd my-app
|
|
20
|
+
|
|
21
|
+
# Run the dev server
|
|
22
|
+
kin run
|
|
23
|
+
|
|
24
|
+
# Build for web
|
|
25
|
+
kin build web
|
|
26
|
+
|
|
27
|
+
# Build for mobile (React Native)
|
|
28
|
+
kin build mobile
|
|
29
|
+
|
|
30
|
+
# Build for desktop (Electron)
|
|
31
|
+
kin build desktop
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## CLI Commands
|
|
35
|
+
|
|
36
|
+
| Command | Description |
|
|
37
|
+
|---------|-------------|
|
|
38
|
+
| `kin init <template> <name>` | Create a new project |
|
|
39
|
+
| `kin run [entry]` | Compile and run with dev server |
|
|
40
|
+
| `kin build [web\|mobile\|desktop]` | Compile for a target platform |
|
|
41
|
+
| `kin install <package>` | Install a Kin package |
|
|
42
|
+
| `kin search <query>` | Search the Kin package registry |
|
|
43
|
+
| `kin publish` | Publish a package to the registry |
|
|
44
|
+
| `kin test [files]` | Run `.test.kin` test files |
|
|
45
|
+
| `kin fmt [files]` | Format Kin source files |
|
|
46
|
+
| `kin lint [files]` | Lint and check code quality |
|
|
47
|
+
| `kin docs [files]` | Generate HTML/Markdown documentation |
|
|
48
|
+
| `kin repl` | Start an interactive REPL shell |
|
|
49
|
+
| `kin lsp` | Start the Language Server (for editors) |
|
|
50
|
+
| `kin std` | List built-in standard library modules |
|
|
51
|
+
|
|
52
|
+
## Project Templates
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
kin init web-app my-website # React web app
|
|
56
|
+
kin init mobile-app my-mobile # React Native mobile app
|
|
57
|
+
kin init dashboard my-dashboard # Admin dashboard
|
|
58
|
+
kin init ecommerce my-shop # E-commerce app
|
|
59
|
+
kin init backend-api my-api # REST API backend
|
|
60
|
+
kin init package my-package # Reusable Kin package
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Example Kin Code
|
|
64
|
+
|
|
65
|
+
```kin
|
|
66
|
+
app MyApp
|
|
67
|
+
|
|
68
|
+
screen Home
|
|
69
|
+
state count = 0
|
|
70
|
+
|
|
71
|
+
on mount
|
|
72
|
+
log "App loaded!"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
column
|
|
76
|
+
text "Welcome to Kin!" style {
|
|
77
|
+
color: "blue"
|
|
78
|
+
font-size: 24
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
button "Click me" on click
|
|
82
|
+
count = count + 1
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
text "Clicked: {count} times"
|
|
86
|
+
|
|
87
|
+
show if count > 5
|
|
88
|
+
text "You clicked a lot!"
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Standard Library
|
|
95
|
+
|
|
96
|
+
```kin
|
|
97
|
+
import math from "std:math"
|
|
98
|
+
import time from "std:time"
|
|
99
|
+
import http from "std:http"
|
|
100
|
+
import json from "std:json"
|
|
101
|
+
import fs from "std:fs"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Testing
|
|
105
|
+
|
|
106
|
+
```kin
|
|
107
|
+
describe "My feature"
|
|
108
|
+
test "addition works"
|
|
109
|
+
number result = 2 + 2
|
|
110
|
+
assert result == 4
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Run tests with:
|
|
116
|
+
```bash
|
|
117
|
+
kin test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## VS Code Extension
|
|
121
|
+
|
|
122
|
+
Install the Kin VS Code extension for syntax highlighting, autocomplete, and diagnostics:
|
|
123
|
+
|
|
124
|
+
1. Build the extension: `npm run package:ext` (from the project root)
|
|
125
|
+
2. Install it: `code --install-extension vscode-extension/kin-lang.vsix`
|
|
126
|
+
|
|
127
|
+
Or publish it to the VS Code Marketplace for one-click installs.
|
|
128
|
+
|
|
129
|
+
## Requirements
|
|
130
|
+
|
|
131
|
+
- **Node.js** 18 or higher
|
|
132
|
+
- **npm** 8 or higher
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT — see [LICENSE](LICENSE)
|
|
137
|
+
|
|
138
|
+
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as math from "./kin_std/math.js";
|
|
2
|
+
import * as time from "./kin_std/time.js";
|
|
3
|
+
import * as json from "./kin_std/json.js";
|
|
4
|
+
let q = math.square(3);
|
|
5
|
+
console.log(a);
|
|
6
|
+
console.log(b);
|
|
7
|
+
console.log(s);
|
|
8
|
+
let ts = time.now();
|
|
9
|
+
console.log(ts);
|
|
10
|
+
let data = json.stringify(42);
|
|
11
|
+
console.log(data);
|
package/dist/kin-cli.js
ADDED