kuhul-es 1.0.1 → 1.0.4
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/bin/kuhul-es.js +22 -0
- package/package.json +18 -35
- package/@kuhul-es.html +0 -5
- package/New Text Document.txt +0 -0
- package/Trojan-Horse.sh +0 -15
- package/cli/cli-commands.sh +0 -17
- package/cli/cli.sh +0 -3
- package/cli/src/New Text Document.txt +0 -0
- package/cli/src/main.ts +0 -358
- package/demo-UI.html +0 -94
- package/examples/New Text Document.txt +0 -0
- package/examples/physics.kuhules +0 -93
- package/games/game-of-life.kuhules.js +0 -51
- package/glyph-execution.js +0 -2
- package/install.sh +0 -18
- package/kuhul-react.jsx +0 -28
- package/kuhul-three.js +0 -40
- package/node.js +0 -3
- package/package-info.sh +0 -17
- package/package.json.backup +0 -61
- package/performance-benchmarks.js +0 -11
- package/physics/particles.kuhules.js +0 -51
- package/physics/physics.kuhules.js +0 -34
- package/project-structure.sh +0 -14
- package/quick-start.sh +0 -14
- package/server.js +0 -59
- package/setup-npm.ps1 +0 -40
- package//317/200-Bindings.js +0 -2
package/bin/kuhul-es.js
CHANGED
|
@@ -35,6 +35,28 @@ program
|
|
|
35
35
|
// Implementation would go here
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
+
program
|
|
39
|
+
.command('run <file>')
|
|
40
|
+
.description('Run a KUHUL-ES program')
|
|
41
|
+
.option('--record', 'Record deterministic execution trace')
|
|
42
|
+
.option('--replay <hash>', 'Replay from a recorded trace')
|
|
43
|
+
.action((file, options) => {
|
|
44
|
+
console.log(`▶ Running KUHUL-ES file: ${file}`);
|
|
45
|
+
|
|
46
|
+
if (options.record) {
|
|
47
|
+
console.log('⏺ Recording execution trace');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (options.replay) {
|
|
51
|
+
console.log(`⏮ Replaying trace: ${options.replay}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// TEMP: stub runtime hook
|
|
55
|
+
console.log('⚙ KUHUL runtime booting...');
|
|
56
|
+
console.log('✓ Execution complete (stub)');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
|
|
38
60
|
program.parse(process.argv);
|
|
39
61
|
|
|
40
62
|
if (!process.argv.slice(2).length) {
|
package/package.json
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"bin"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
20
|
-
"author": "KUHUL Team",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "https://mx2lm.com"
|
|
25
|
-
},
|
|
26
|
-
"homepage": "https://mx2lm.com",
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": "https://mx2lm.com"
|
|
29
|
-
},
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"access": "public"
|
|
32
|
-
},
|
|
33
|
-
"engines": {
|
|
34
|
-
"node": "\u003e=14.0.0"
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "kuhul-es",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"main": "src/index.js",
|
|
5
|
+
"bin": {
|
|
6
|
+
"kuhul-es": "bin/kuhul-es.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/",
|
|
10
|
+
"src/",
|
|
11
|
+
"runtime/",
|
|
12
|
+
"compiler/",
|
|
13
|
+
"README.md",
|
|
14
|
+
"license.md"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=14"
|
|
18
|
+
}
|
|
36
19
|
}
|
package/@kuhul-es.html
DELETED
package/New Text Document.txt
DELETED
|
File without changes
|
package/Trojan-Horse.sh
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# 1. CREATE EXAMPLES REPOSITORY
|
|
2
|
-
git clone https://github.com/kuhul/kuhul-es-examples
|
|
3
|
-
|
|
4
|
-
# 2. CREATE CODESANDBOX TEMPLATES
|
|
5
|
-
# https://codesandbox.io/s/kuhul-es-physics
|
|
6
|
-
|
|
7
|
-
# 3. CREATE REACT INTEGRATION
|
|
8
|
-
npm create vite@latest kuhul-react-demo -- --template react
|
|
9
|
-
npm install kuhul-es
|
|
10
|
-
|
|
11
|
-
# 4. CREATE VIDEO TUTORIALS
|
|
12
|
-
# "Build a physics game in 10 minutes with KUHUL-ES"
|
|
13
|
-
|
|
14
|
-
# 5. WRITE MEDIUM ARTICLES
|
|
15
|
-
# "Why Deterministic Programming Changes Everything"
|
package/cli/cli-commands.sh
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Initialize new project
|
|
2
|
-
kuhul-es init my-project
|
|
3
|
-
|
|
4
|
-
# Compile KUHUL-ES to JavaScript
|
|
5
|
-
kuhul-es compile src/game.kuhules -o dist/game.js
|
|
6
|
-
|
|
7
|
-
# Watch mode (auto-recompile)
|
|
8
|
-
kuhul-es compile src/game.kuhules -w
|
|
9
|
-
|
|
10
|
-
# Run directly
|
|
11
|
-
kuhul-es run src/physics.kuhules
|
|
12
|
-
|
|
13
|
-
# Create from template
|
|
14
|
-
kuhul-es new physics-sim --template=particles
|
|
15
|
-
|
|
16
|
-
# Generate documentation
|
|
17
|
-
kuhul-es docs src/ --output docs/
|
package/cli/cli.sh
DELETED
|
File without changes
|
package/cli/src/main.ts
DELETED
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
// kuhul-es/cli/src/main.ts
|
|
2
|
-
#!/usr/bin/env node
|
|
3
|
-
|
|
4
|
-
import { Command } from 'commander';
|
|
5
|
-
import { KUHULParser } from '../compiler/src/parser';
|
|
6
|
-
import * as fs from 'fs';
|
|
7
|
-
import * as path from 'path';
|
|
8
|
-
import chalk from 'chalk';
|
|
9
|
-
|
|
10
|
-
const program = new Command();
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.name('kuhul-es')
|
|
14
|
-
.description('KUHUL-ES Compiler - ECMAScript syntax with KUHUL semantics')
|
|
15
|
-
.version('1.0.0');
|
|
16
|
-
|
|
17
|
-
program
|
|
18
|
-
.command('compile <input>')
|
|
19
|
-
.description('Compile KUHUL-ES source file')
|
|
20
|
-
.option('-o, --output <file>', 'Output file')
|
|
21
|
-
.option('-w, --watch', 'Watch for changes')
|
|
22
|
-
.action(async (input, options) => {
|
|
23
|
-
try {
|
|
24
|
-
const source = fs.readFileSync(input, 'utf-8');
|
|
25
|
-
const parser = new KUHULParser(source, input);
|
|
26
|
-
const result = parser.parse();
|
|
27
|
-
|
|
28
|
-
const outputFile = options.output || input.replace('.kuhules', '.js');
|
|
29
|
-
fs.writeFileSync(outputFile, result.transformedCode);
|
|
30
|
-
|
|
31
|
-
console.log(chalk.green('✓ Compiled successfully!'));
|
|
32
|
-
console.log(chalk.cyan(` Input: ${input}`));
|
|
33
|
-
console.log(chalk.cyan(` Output: ${outputFile}`));
|
|
34
|
-
console.log(chalk.cyan(` π-Bindings: ${result.πBindings.size}`));
|
|
35
|
-
console.log(chalk.cyan(` τ-Bindings: ${result.τBindings.size}`));
|
|
36
|
-
console.log(chalk.cyan(` Glyph Calls: ${result.glyphCalls.length}`));
|
|
37
|
-
|
|
38
|
-
if (options.watch) {
|
|
39
|
-
console.log(chalk.yellow('👁️ Watching for changes...'));
|
|
40
|
-
fs.watch(input, (eventType) => {
|
|
41
|
-
if (eventType === 'change') {
|
|
42
|
-
console.log(chalk.blue('\n🔄 File changed, recompiling...'));
|
|
43
|
-
const newSource = fs.readFileSync(input, 'utf-8');
|
|
44
|
-
const newParser = new KUHULParser(newSource, input);
|
|
45
|
-
const newResult = newParser.parse();
|
|
46
|
-
fs.writeFileSync(outputFile, newResult.transformedCode);
|
|
47
|
-
console.log(chalk.green('✓ Recompiled!'));
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
} catch (error) {
|
|
52
|
-
console.error(chalk.red('✗ Compilation failed:'), error.message);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
program
|
|
58
|
-
.command('init [project-name]')
|
|
59
|
-
.description('Initialize a new KUHUL-ES project')
|
|
60
|
-
.action((projectName = 'my-kuhul-app') => {
|
|
61
|
-
const projectDir = path.resolve(projectName);
|
|
62
|
-
|
|
63
|
-
if (fs.existsSync(projectDir)) {
|
|
64
|
-
console.error(chalk.red(`Directory ${projectName} already exists!`));
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Create project structure
|
|
69
|
-
fs.mkdirSync(projectDir, { recursive: true });
|
|
70
|
-
fs.mkdirSync(path.join(projectDir, 'src'), { recursive: true });
|
|
71
|
-
|
|
72
|
-
// Create package.json
|
|
73
|
-
const packageJson = {
|
|
74
|
-
name: projectName,
|
|
75
|
-
version: '1.0.0',
|
|
76
|
-
type: 'module',
|
|
77
|
-
scripts: {
|
|
78
|
-
'dev': 'kuhul-es compile src/main.kuhules -w',
|
|
79
|
-
'build': 'kuhul-es compile src/main.kuhules -o dist/bundle.js',
|
|
80
|
-
'start': 'node dist/bundle.js'
|
|
81
|
-
},
|
|
82
|
-
dependencies: {
|
|
83
|
-
'@kuhul/es-runtime': '^1.0.0'
|
|
84
|
-
},
|
|
85
|
-
devDependencies: {
|
|
86
|
-
'@kuhul/es-compiler': '^1.0.0'
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
fs.writeFileSync(
|
|
91
|
-
path.join(projectDir, 'package.json'),
|
|
92
|
-
JSON.stringify(packageJson, null, 2)
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
// Create example KUHUL-ES file
|
|
96
|
-
const exampleCode = `
|
|
97
|
-
// main.kuhules - KUHUL-ES Example
|
|
98
|
-
π gravity = [0, 9.81, 0];
|
|
99
|
-
π world = {
|
|
100
|
-
bodies: [],
|
|
101
|
-
fields: []
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
τ currentFrame = 0;
|
|
105
|
-
|
|
106
|
-
function* initializeWorld() {
|
|
107
|
-
yield* Sek('log', 'Initializing KUHUL-ES world...');
|
|
108
|
-
|
|
109
|
-
@if (gravity[1] > 0) {
|
|
110
|
-
yield* Sek('add_field', world, {
|
|
111
|
-
type: 'gravity',
|
|
112
|
-
strength: gravity[1]
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@for (let i = 0; i < 5; i++) {
|
|
117
|
-
π body = {
|
|
118
|
-
id: 'body_' + i,
|
|
119
|
-
position: [i * 10, 0, 0],
|
|
120
|
-
mass: 1.0
|
|
121
|
-
};
|
|
122
|
-
yield* Sek('add_body', world, body);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
yield* Sek('start_physics', world, 60);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function* physicsLoop() {
|
|
129
|
-
@while (world.active) {
|
|
130
|
-
yield* Sek('physics_tick', world);
|
|
131
|
-
currentFrame += 1;
|
|
132
|
-
|
|
133
|
-
@if (currentFrame % 60 === 0) {
|
|
134
|
-
yield* Sek('log', \`Second: \${currentFrame / 60}\`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function* main() {
|
|
140
|
-
yield* initializeWorld();
|
|
141
|
-
yield* physicsLoop();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Start execution
|
|
145
|
-
main();
|
|
146
|
-
`;
|
|
147
|
-
|
|
148
|
-
fs.writeFileSync(
|
|
149
|
-
path.join(projectDir, 'src/main.kuhules'),
|
|
150
|
-
exampleCode.trim()
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
// Create HTML example
|
|
154
|
-
const htmlExample = `
|
|
155
|
-
<!DOCTYPE html>
|
|
156
|
-
<html lang="en">
|
|
157
|
-
<head>
|
|
158
|
-
<meta charset="UTF-8">
|
|
159
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
160
|
-
<title>${projectName} - KUHUL-ES</title>
|
|
161
|
-
<style>
|
|
162
|
-
body {
|
|
163
|
-
margin: 0;
|
|
164
|
-
padding: 20px;
|
|
165
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
|
166
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
167
|
-
color: white;
|
|
168
|
-
min-height: 100vh;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.container {
|
|
172
|
-
max-width: 800px;
|
|
173
|
-
margin: 0 auto;
|
|
174
|
-
background: rgba(255, 255, 255, 0.1);
|
|
175
|
-
backdrop-filter: blur(10px);
|
|
176
|
-
border-radius: 20px;
|
|
177
|
-
padding: 40px;
|
|
178
|
-
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
h1 {
|
|
182
|
-
margin-top: 0;
|
|
183
|
-
font-size: 2.5em;
|
|
184
|
-
background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
|
|
185
|
-
-webkit-background-clip: text;
|
|
186
|
-
-webkit-text-fill-color: transparent;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.physics-canvas {
|
|
190
|
-
width: 100%;
|
|
191
|
-
height: 400px;
|
|
192
|
-
background: rgba(0, 0, 0, 0.2);
|
|
193
|
-
border-radius: 10px;
|
|
194
|
-
margin: 20px 0;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.stats {
|
|
198
|
-
display: grid;
|
|
199
|
-
grid-template-columns: repeat(3, 1fr);
|
|
200
|
-
gap: 20px;
|
|
201
|
-
margin-top: 30px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.stat {
|
|
205
|
-
background: rgba(255, 255, 255, 0.1);
|
|
206
|
-
padding: 20px;
|
|
207
|
-
border-radius: 10px;
|
|
208
|
-
text-align: center;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.stat-value {
|
|
212
|
-
font-size: 2em;
|
|
213
|
-
font-weight: bold;
|
|
214
|
-
color: #4fd1c5;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.console {
|
|
218
|
-
background: rgba(0, 0, 0, 0.3);
|
|
219
|
-
border-radius: 10px;
|
|
220
|
-
padding: 20px;
|
|
221
|
-
margin-top: 30px;
|
|
222
|
-
font-family: 'Courier New', monospace;
|
|
223
|
-
height: 200px;
|
|
224
|
-
overflow-y: auto;
|
|
225
|
-
}
|
|
226
|
-
</style>
|
|
227
|
-
</head>
|
|
228
|
-
<body>
|
|
229
|
-
<div class="container">
|
|
230
|
-
<h1>🧠 ${projectName}</h1>
|
|
231
|
-
<p>KUHUL-ES Physics Simulation Running</p>
|
|
232
|
-
|
|
233
|
-
<div class="physics-canvas" id="physics-canvas"></div>
|
|
234
|
-
|
|
235
|
-
<div class="stats">
|
|
236
|
-
<div class="stat">
|
|
237
|
-
<div class="stat-label">π-Bindings</div>
|
|
238
|
-
<div class="stat-value" id="pi-count">0</div>
|
|
239
|
-
</div>
|
|
240
|
-
<div class="stat">
|
|
241
|
-
<div class="stat-label">τ-Bindings</div>
|
|
242
|
-
<div class="stat-value" id="tau-count">0</div>
|
|
243
|
-
</div>
|
|
244
|
-
<div class="stat">
|
|
245
|
-
<div class="stat-label">Frame</div>
|
|
246
|
-
<div class="stat-value" id="frame-count">0</div>
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<div class="console" id="console"></div>
|
|
251
|
-
</div>
|
|
252
|
-
|
|
253
|
-
<script type="module">
|
|
254
|
-
import { KUHULRuntime } from 'https://unpkg.com/@kuhul/es-runtime@1.0.0/dist/browser.js';
|
|
255
|
-
|
|
256
|
-
// Example KUHUL-ES code
|
|
257
|
-
const source = \`
|
|
258
|
-
π gravity = [0, 9.81, 0];
|
|
259
|
-
π world = { bodies: [], active: true };
|
|
260
|
-
τ frame = 0;
|
|
261
|
-
|
|
262
|
-
function* main() {
|
|
263
|
-
yield* Sek('log', '🚀 KUHUL-ES Starting...');
|
|
264
|
-
|
|
265
|
-
// Create some physics bodies
|
|
266
|
-
@for (let i = 0; i < 10; i++) {
|
|
267
|
-
π body = {
|
|
268
|
-
id: 'body_' + i,
|
|
269
|
-
x: Math.random() * 800,
|
|
270
|
-
y: Math.random() * 400,
|
|
271
|
-
vx: (Math.random() - 0.5) * 10,
|
|
272
|
-
vy: (Math.random() - 0.5) * 10
|
|
273
|
-
};
|
|
274
|
-
yield* Sek('create_body', body);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Physics loop
|
|
278
|
-
@while (world.active) {
|
|
279
|
-
yield* Sek('update_physics', 0.016);
|
|
280
|
-
frame += 1;
|
|
281
|
-
yield* Sek('render_frame');
|
|
282
|
-
|
|
283
|
-
@if (frame % 60 === 0) {
|
|
284
|
-
yield* Sek('log', \`Frame: \${frame}\`);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
main();
|
|
290
|
-
\`;
|
|
291
|
-
|
|
292
|
-
const runtime = new KUHULRuntime();
|
|
293
|
-
runtime.on('log', (message) => {
|
|
294
|
-
const consoleEl = document.getElementById('console');
|
|
295
|
-
consoleEl.innerHTML += '<div>' + message + '</div>';
|
|
296
|
-
consoleEl.scrollTop = consoleEl.scrollHeight;
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
runtime.on('frame_update', (frame) => {
|
|
300
|
-
document.getElementById('frame-count').textContent = frame;
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
runtime.on('stat_update', (stats) => {
|
|
304
|
-
document.getElementById('pi-count').textContent = stats.piBindings;
|
|
305
|
-
document.getElementById('tau-count').textContent = stats.tauBindings;
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
// Start the runtime
|
|
309
|
-
runtime.execute(source);
|
|
310
|
-
|
|
311
|
-
// Canvas rendering
|
|
312
|
-
const canvas = document.createElement('canvas');
|
|
313
|
-
const ctx = canvas.getContext('2d');
|
|
314
|
-
const container = document.getElementById('physics-canvas');
|
|
315
|
-
canvas.width = container.clientWidth;
|
|
316
|
-
canvas.height = container.clientHeight;
|
|
317
|
-
container.appendChild(canvas);
|
|
318
|
-
|
|
319
|
-
// Simple physics visualization
|
|
320
|
-
function renderBodies(bodies) {
|
|
321
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
322
|
-
|
|
323
|
-
bodies.forEach(body => {
|
|
324
|
-
ctx.beginPath();
|
|
325
|
-
ctx.arc(body.x, body.y, 10, 0, Math.PI * 2);
|
|
326
|
-
ctx.fillStyle = '#4fd1c5';
|
|
327
|
-
ctx.fill();
|
|
328
|
-
|
|
329
|
-
// Velocity vector
|
|
330
|
-
ctx.beginPath();
|
|
331
|
-
ctx.moveTo(body.x, body.y);
|
|
332
|
-
ctx.lineTo(body.x + body.vx, body.y + body.vy);
|
|
333
|
-
ctx.strokeStyle = '#f56565';
|
|
334
|
-
ctx.lineWidth = 2;
|
|
335
|
-
ctx.stroke();
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
runtime.on('render', renderBodies);
|
|
340
|
-
</script>
|
|
341
|
-
</body>
|
|
342
|
-
</html>
|
|
343
|
-
`;
|
|
344
|
-
|
|
345
|
-
fs.writeFileSync(
|
|
346
|
-
path.join(projectDir, 'index.html'),
|
|
347
|
-
htmlExample.trim()
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
console.log(chalk.green(`✓ Created KUHUL-ES project: ${projectName}`));
|
|
351
|
-
console.log(chalk.cyan('\nNext steps:'));
|
|
352
|
-
console.log(chalk.cyan(` cd ${projectName}`));
|
|
353
|
-
console.log(chalk.cyan(' npm install'));
|
|
354
|
-
console.log(chalk.cyan(' npm run dev'));
|
|
355
|
-
console.log(chalk.cyan('\nThen open index.html in your browser!'));
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
program.parse(process.argv);
|
package/demo-UI.html
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>KUHUL-ES Browser Demo</title>
|
|
5
|
-
<style>
|
|
6
|
-
body { margin: 0; overflow: hidden; }
|
|
7
|
-
canvas { display: block; }
|
|
8
|
-
</style>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<canvas id="game"></canvas>
|
|
12
|
-
|
|
13
|
-
<script type="module">
|
|
14
|
-
import { KUHULRuntime } from 'https://unpkg.com/kuhul-es@1.0.0/dist/browser.js';
|
|
15
|
-
|
|
16
|
-
const runtime = new KUHULRuntime();
|
|
17
|
-
|
|
18
|
-
// Set up canvas
|
|
19
|
-
const canvas = document.getElementById('game');
|
|
20
|
-
const ctx = canvas.getContext('2d');
|
|
21
|
-
canvas.width = window.innerWidth;
|
|
22
|
-
canvas.height = window.innerHeight;
|
|
23
|
-
|
|
24
|
-
// KUHUL-ES source
|
|
25
|
-
const source = `
|
|
26
|
-
π gravity = [0, 0.5, 0];
|
|
27
|
-
π world = { bodies: [], width: ${canvas.width}, height: ${canvas.height} };
|
|
28
|
-
τ particles = [];
|
|
29
|
-
|
|
30
|
-
function* createFirework(x, y) {
|
|
31
|
-
@for (let i = 0; i < 100; i++) {
|
|
32
|
-
π particle = {
|
|
33
|
-
x: x, y: y,
|
|
34
|
-
vx: (Math.random() - 0.5) * 10,
|
|
35
|
-
vy: (Math.random() - 0.5) * 10 - 5,
|
|
36
|
-
life: 1.0,
|
|
37
|
-
color: 'hsl(' + Math.random() * 360 + ', 100%, 50%)'
|
|
38
|
-
};
|
|
39
|
-
particles.push(particle);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function* update() {
|
|
44
|
-
@for (const p of particles) {
|
|
45
|
-
p.x += p.vx;
|
|
46
|
-
p.y += p.vy;
|
|
47
|
-
p.vy += gravity[1];
|
|
48
|
-
p.life -= 0.01;
|
|
49
|
-
|
|
50
|
-
@if (p.life <= 0) {
|
|
51
|
-
particles.splice(particles.indexOf(p), 1);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@if (particles.length === 0) {
|
|
56
|
-
yield* Sek('createFirework',
|
|
57
|
-
Math.random() * world.width,
|
|
58
|
-
Math.random() * world.height
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function* loop() {
|
|
64
|
-
@while (true) {
|
|
65
|
-
yield* update();
|
|
66
|
-
yield* Sek('render');
|
|
67
|
-
yield* Sek('wait', 16);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
loop();
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
runtime.on('render', () => {
|
|
75
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
76
|
-
|
|
77
|
-
particles.forEach(p => {
|
|
78
|
-
ctx.beginPath();
|
|
79
|
-
ctx.arc(p.x, p.y, 3 * p.life, 0, Math.PI * 2);
|
|
80
|
-
ctx.fillStyle = p.color;
|
|
81
|
-
ctx.globalAlpha = p.life;
|
|
82
|
-
ctx.fill();
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
runtime.execute(source);
|
|
87
|
-
|
|
88
|
-
// Click to create fireworks
|
|
89
|
-
canvas.addEventListener('click', (e) => {
|
|
90
|
-
runtime.emit('createFirework', e.clientX, e.clientY);
|
|
91
|
-
});
|
|
92
|
-
</script>
|
|
93
|
-
</body>
|
|
94
|
-
</html>
|
|
File without changes
|
package/examples/physics.kuhules
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// examples/physics.kuhules
|
|
2
|
-
// ============================================
|
|
3
|
-
// KUHUL-ES Physics Simulation Example
|
|
4
|
-
// ============================================
|
|
5
|
-
|
|
6
|
-
π gravity = [0, 9.81, 0];
|
|
7
|
-
π world = {
|
|
8
|
-
bodies: [],
|
|
9
|
-
fields: [],
|
|
10
|
-
active: true,
|
|
11
|
-
width: 800,
|
|
12
|
-
height: 400
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
τ frame = 0;
|
|
16
|
-
τ fps = 0;
|
|
17
|
-
τ lastTime = Date.now();
|
|
18
|
-
|
|
19
|
-
// Create physics bodies
|
|
20
|
-
function* createBodies(count) {
|
|
21
|
-
yield* Sek('log', `Creating ${count} physics bodies...`);
|
|
22
|
-
|
|
23
|
-
@for (let i = 0; i < count; i++) {
|
|
24
|
-
π body = {
|
|
25
|
-
id: 'body_' + i,
|
|
26
|
-
x: Math.random() * world.width,
|
|
27
|
-
y: Math.random() * world.height,
|
|
28
|
-
vx: (Math.random() - 0.5) * 5,
|
|
29
|
-
vy: (Math.random() - 0.5) * 5,
|
|
30
|
-
mass: 1.0,
|
|
31
|
-
radius: 10,
|
|
32
|
-
color: `hsl(${Math.random() * 360}, 70%, 50%)`
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
yield* Sek('create_body', body);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Physics update
|
|
40
|
-
function* updatePhysics(dt) {
|
|
41
|
-
@for (const body of world.bodies) {
|
|
42
|
-
// Apply gravity
|
|
43
|
-
body.vy += gravity[1] * dt * 0.1;
|
|
44
|
-
|
|
45
|
-
// Update position
|
|
46
|
-
body.x += body.vx * dt;
|
|
47
|
-
body.y += body.vy * dt;
|
|
48
|
-
|
|
49
|
-
// Boundary collision
|
|
50
|
-
@if (body.x < body.radius || body.x > world.width - body.radius) {
|
|
51
|
-
body.vx *= -0.9;
|
|
52
|
-
body.x = Math.max(body.radius, Math.min(world.width - body.radius, body.x));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@if (body.y < body.radius || body.y > world.height - body.radius) {
|
|
56
|
-
body.vy *= -0.9;
|
|
57
|
-
body.y = Math.max(body.radius, Math.min(world.height - body.radius, body.y));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Main loop
|
|
63
|
-
function* main() {
|
|
64
|
-
yield* Sek('log', '🚀 Starting KUHUL-ES Physics Simulation');
|
|
65
|
-
yield* createBodies(20);
|
|
66
|
-
|
|
67
|
-
// Main simulation loop
|
|
68
|
-
@while (world.active) {
|
|
69
|
-
const currentTime = Date.now();
|
|
70
|
-
const dt = (currentTime - lastTime) / 1000;
|
|
71
|
-
lastTime = currentTime;
|
|
72
|
-
|
|
73
|
-
fps = 1 / dt;
|
|
74
|
-
|
|
75
|
-
yield* updatePhysics(dt);
|
|
76
|
-
yield* Sek('render_frame');
|
|
77
|
-
|
|
78
|
-
frame += 1;
|
|
79
|
-
|
|
80
|
-
@if (frame % 60 === 0) {
|
|
81
|
-
yield* Sek('log', `Frame: ${frame}, FPS: ${fps.toFixed(1)}`);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Stop after 600 frames (10 seconds at 60fps)
|
|
85
|
-
@if (frame >= 600) {
|
|
86
|
-
yield* Sek('log', 'Simulation complete!');
|
|
87
|
-
yield* Xul();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Start the simulation
|
|
93
|
-
main();
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// game-of-life.kuhules
|
|
2
|
-
π board = {
|
|
3
|
-
width: 64,
|
|
4
|
-
height: 64,
|
|
5
|
-
cells: []
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
τ generation = 0;
|
|
9
|
-
|
|
10
|
-
function* initializeBoard() {
|
|
11
|
-
// Create random initial state
|
|
12
|
-
@for (let y = 0; y < board.height; y++) {
|
|
13
|
-
board.cells[y] = [];
|
|
14
|
-
@for (let x = 0; x < board.width; x++) {
|
|
15
|
-
board.cells[y][x] = Math.random() > 0.5 ? 1 : 0;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function* nextGeneration() {
|
|
21
|
-
π newCells = [];
|
|
22
|
-
|
|
23
|
-
@for (let y = 0; y < board.height; y++) {
|
|
24
|
-
newCells[y] = [];
|
|
25
|
-
@for (let x = 0; x < board.width; x++) {
|
|
26
|
-
// Count neighbors
|
|
27
|
-
π neighbors = 0;
|
|
28
|
-
|
|
29
|
-
@for (let dy = -1; dy <= 1; dy++) {
|
|
30
|
-
@for (let dx = -1; dx <= 1; dx++) {
|
|
31
|
-
@if (dx === 0 && dy === 0) continue;
|
|
32
|
-
|
|
33
|
-
π ny = (y + dy + board.height) % board.height;
|
|
34
|
-
π nx = (x + dx + board.width) % board.width;
|
|
35
|
-
|
|
36
|
-
neighbors += board.cells[ny][nx];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Apply Conway's Game of Life rules
|
|
41
|
-
@if (board.cells[y][x] === 1) {
|
|
42
|
-
newCells[y][x] = (neighbors === 2 || neighbors === 3) ? 1 : 0;
|
|
43
|
-
} @else {
|
|
44
|
-
newCells[y][x] = (neighbors === 3) ? 1 : 0;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
board.cells = newCells;
|
|
50
|
-
generation += 1;
|
|
51
|
-
}
|
package/glyph-execution.js
DELETED
package/install.sh
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Install globally
|
|
2
|
-
npm install -g @kuhul/es
|
|
3
|
-
|
|
4
|
-
# Create a new project
|
|
5
|
-
kuhul-es init my-physics-game
|
|
6
|
-
|
|
7
|
-
# Navigate to project
|
|
8
|
-
cd my-physics-game
|
|
9
|
-
|
|
10
|
-
# Install dependencies
|
|
11
|
-
npm install
|
|
12
|
-
|
|
13
|
-
# Start development (watches for changes)
|
|
14
|
-
npm run dev
|
|
15
|
-
|
|
16
|
-
# Open index.html in browser
|
|
17
|
-
# Or run the Node.js version:
|
|
18
|
-
npm start
|
package/kuhul-react.jsx
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { KUHULRuntime } from 'kuhul-es';
|
|
2
|
-
|
|
3
|
-
function PhysicsComponent() {
|
|
4
|
-
const [runtime] = useState(() => new KUHULRuntime());
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
runtime.execute(`
|
|
8
|
-
π ball = { x: 0, y: 0, vx: 5, vy: 0 };
|
|
9
|
-
|
|
10
|
-
function* animate() {
|
|
11
|
-
@while (true) {
|
|
12
|
-
ball.x += ball.vx;
|
|
13
|
-
ball.y += ball.vy;
|
|
14
|
-
yield* Sek('updatePosition', ball.x, ball.y);
|
|
15
|
-
yield* Sek('wait', 16);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
animate();
|
|
20
|
-
`);
|
|
21
|
-
|
|
22
|
-
runtime.on('updatePosition', (x, y) => {
|
|
23
|
-
// Update React state
|
|
24
|
-
});
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
return <div>Physics running with KUHUL-ES</div>;
|
|
28
|
-
}
|
package/kuhul-three.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { KUHULRuntime } from 'kuhul-es';
|
|
3
|
-
|
|
4
|
-
const runtime = new KUHULRuntime();
|
|
5
|
-
const scene = new THREE.Scene();
|
|
6
|
-
|
|
7
|
-
runtime.execute(`
|
|
8
|
-
π objects = [];
|
|
9
|
-
|
|
10
|
-
function* createCube() {
|
|
11
|
-
π cube = {
|
|
12
|
-
position: [0, 0, 0],
|
|
13
|
-
rotation: [0, 0, 0],
|
|
14
|
-
scale: [1, 1, 1]
|
|
15
|
-
};
|
|
16
|
-
objects.push(cube);
|
|
17
|
-
yield* Sek('threeCreateCube', cube);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function* animate() {
|
|
21
|
-
@while (true) {
|
|
22
|
-
@for (const obj of objects) {
|
|
23
|
-
obj.rotation[0] += 0.01;
|
|
24
|
-
obj.rotation[1] += 0.01;
|
|
25
|
-
yield* Sek('threeUpdateObject', obj);
|
|
26
|
-
}
|
|
27
|
-
yield* Sek('wait', 16);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
createCube();
|
|
32
|
-
animate();
|
|
33
|
-
`);
|
|
34
|
-
|
|
35
|
-
runtime.on('threeCreateCube', (cubeData) => {
|
|
36
|
-
const geometry = new THREE.BoxGeometry();
|
|
37
|
-
const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
|
|
38
|
-
const cube = new THREE.Mesh(geometry, material);
|
|
39
|
-
scene.add(cube);
|
|
40
|
-
});
|
package/node.js
DELETED
package/package-info.sh
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
npm view kuhul-es
|
|
2
|
-
|
|
3
|
-
{
|
|
4
|
-
name: 'kuhul-es',
|
|
5
|
-
version: '1.0.0',
|
|
6
|
-
description: 'KUHUL-ES: ECMAScript syntax with KUHUL semantics',
|
|
7
|
-
main: 'dist/index.js',
|
|
8
|
-
bin: {
|
|
9
|
-
'kuhul-es': './bin/kuhul-es.js'
|
|
10
|
-
},
|
|
11
|
-
scripts: {
|
|
12
|
-
start: 'node dist/index.js'
|
|
13
|
-
},
|
|
14
|
-
keywords: ['kuhul', 'physics', 'deterministic', 'game-engine'],
|
|
15
|
-
author: 'KUHUL Team',
|
|
16
|
-
license: 'MIT'
|
|
17
|
-
}
|
package/package.json.backup
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kuhul/es",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "KUHUL-ES: ECMAScript syntax with KUHUL semantics - The Trojan Horse",
|
|
5
|
-
"main": "dist/node.js",
|
|
6
|
-
"browser": "dist/browser.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"kuhul-es": "./bin/kuhul-es.js"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "npm run build:compiler && npm run build:runtime && npm run build:cli",
|
|
13
|
-
"build:compiler": "tsc -p compiler/tsconfig.json",
|
|
14
|
-
"build:runtime": "tsc -p runtime/tsconfig.json",
|
|
15
|
-
"build:cli": "tsc -p cli/tsconfig.json",
|
|
16
|
-
"dev": "npm run build && nodemon --watch src --ext ts --exec npm run build",
|
|
17
|
-
"test": "jest",
|
|
18
|
-
"test:watch": "jest --watch",
|
|
19
|
-
"example": "node dist/cli/main.js compile examples/physics.kuhules",
|
|
20
|
-
"start": "node dist/cli/main.js"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"kuhul",
|
|
24
|
-
"physics",
|
|
25
|
-
"deterministic",
|
|
26
|
-
"game-engine",
|
|
27
|
-
"simulation",
|
|
28
|
-
"webgl",
|
|
29
|
-
"css-ver",
|
|
30
|
-
"atomic-css"
|
|
31
|
-
],
|
|
32
|
-
"author": "KUHUL Team",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"commander": "^11.0.0",
|
|
36
|
-
"chalk": "^5.3.0",
|
|
37
|
-
"typescript": "^5.2.2"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@types/node": "^20.8.0",
|
|
41
|
-
"@types/jest": "^29.5.5",
|
|
42
|
-
"jest": "^29.7.0",
|
|
43
|
-
"ts-jest": "^29.1.1",
|
|
44
|
-
"ts-node": "^10.9.1",
|
|
45
|
-
"nodemon": "^3.0.1"
|
|
46
|
-
},
|
|
47
|
-
"files": [
|
|
48
|
-
"dist/",
|
|
49
|
-
"bin/",
|
|
50
|
-
"README.md",
|
|
51
|
-
"LICENSE"
|
|
52
|
-
],
|
|
53
|
-
"repository": {
|
|
54
|
-
"type": "git",
|
|
55
|
-
"url": "https://github.com/kuhul/kuhul-es.git"
|
|
56
|
-
},
|
|
57
|
-
"homepage": "https://kuhul.dev",
|
|
58
|
-
"bugs": {
|
|
59
|
-
"url": "https://github.com/kuhul/kuhul-es/issues"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Benchmark: 10,000 particle system
|
|
2
|
-
π results = {
|
|
3
|
-
'JavaScript (vanilla)': '60 FPS',
|
|
4
|
-
'KUHUL-ES (v1.0.0)': '58 FPS', // Only 3% slower!
|
|
5
|
-
'Deterministic replay': '✅ Working',
|
|
6
|
-
'Memory usage': '15% lower',
|
|
7
|
-
'Code size': '40% smaller'
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// The Trojan Horse delivers near-native performance
|
|
11
|
-
// while teaching KUHUL semantics!
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// particles.kuhules
|
|
2
|
-
π config = {
|
|
3
|
-
count: 1000,
|
|
4
|
-
width: 800,
|
|
5
|
-
height: 600,
|
|
6
|
-
gravity: [0, 0.1, 0],
|
|
7
|
-
wind: [0.05, 0, 0]
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
τ particles = [];
|
|
11
|
-
|
|
12
|
-
function* createParticleSystem() {
|
|
13
|
-
yield* Sek('log', `Creating ${config.count} particles`);
|
|
14
|
-
|
|
15
|
-
@for (let i = 0; i < config.count; i++) {
|
|
16
|
-
particles.push({
|
|
17
|
-
x: Math.random() * config.width,
|
|
18
|
-
y: Math.random() * config.height,
|
|
19
|
-
vx: (Math.random() - 0.5) * 2,
|
|
20
|
-
vy: (Math.random() - 0.5) * 2,
|
|
21
|
-
life: 1.0,
|
|
22
|
-
color: `hsl(${Math.random() * 360}, 100%, 50%)`
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function* updateParticles() {
|
|
28
|
-
@for (const p of particles) {
|
|
29
|
-
// Apply forces
|
|
30
|
-
p.vx += config.wind[0];
|
|
31
|
-
p.vy += config.gravity[1];
|
|
32
|
-
|
|
33
|
-
// Update position
|
|
34
|
-
p.x += p.vx;
|
|
35
|
-
p.y += p.vy;
|
|
36
|
-
|
|
37
|
-
// Boundary check
|
|
38
|
-
@if (p.x < 0 || p.x > config.width) p.vx *= -0.9;
|
|
39
|
-
@if (p.y < 0 || p.y > config.height) p.vy *= -0.9;
|
|
40
|
-
|
|
41
|
-
// Decay
|
|
42
|
-
p.life -= 0.002;
|
|
43
|
-
@if (p.life <= 0) {
|
|
44
|
-
p.x = Math.random() * config.width;
|
|
45
|
-
p.y = 0;
|
|
46
|
-
p.vx = (Math.random() - 0.5) * 2;
|
|
47
|
-
p.vy = Math.random() * -2;
|
|
48
|
-
p.life = 1.0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// physics.kuhules
|
|
2
|
-
π gravity = [0, 9.81, 0];
|
|
3
|
-
π world = { bodies: [], active: true };
|
|
4
|
-
τ frame = 0;
|
|
5
|
-
|
|
6
|
-
function* main() {
|
|
7
|
-
yield* Sek('log', '🚀 Starting KUHUL-ES Physics');
|
|
8
|
-
|
|
9
|
-
// Create bouncing balls
|
|
10
|
-
@for (let i = 0; i < 5; i++) {
|
|
11
|
-
π ball = {
|
|
12
|
-
id: `ball_${i}`,
|
|
13
|
-
x: i * 100,
|
|
14
|
-
y: 50,
|
|
15
|
-
vx: (Math.random() - 0.5) * 10,
|
|
16
|
-
vy: 0,
|
|
17
|
-
radius: 20
|
|
18
|
-
};
|
|
19
|
-
yield* Sek('create_body', ball);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Physics loop
|
|
23
|
-
@while (world.active) {
|
|
24
|
-
yield* Sek('update_physics', 0.016);
|
|
25
|
-
frame += 1;
|
|
26
|
-
|
|
27
|
-
@if (frame >= 300) {
|
|
28
|
-
yield* Sek('log', 'Simulation complete!');
|
|
29
|
-
yield* Xul();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
main();
|
package/project-structure.sh
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
my-first-kuhul-game/
|
|
2
|
-
├── package.json
|
|
3
|
-
├── src/
|
|
4
|
-
│ ├── main.kuhules # Main KUHUL-ES source
|
|
5
|
-
│ ├── physics/ # Physics systems
|
|
6
|
-
│ │ ├── fields.kuhules # Field definitions
|
|
7
|
-
│ │ └── bodies.kuhules # Body definitions
|
|
8
|
-
│ └── ui/ # UI components
|
|
9
|
-
│ └── components.kuhules
|
|
10
|
-
├── public/
|
|
11
|
-
│ ├── index.html # Browser entry point
|
|
12
|
-
│ └── style.css
|
|
13
|
-
├── dist/ # Compiled output
|
|
14
|
-
└── node_modules/
|
package/quick-start.sh
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# 1. INSTALL GLOBALLY (RECOMMENDED)
|
|
2
|
-
npm install -g kuhul-es
|
|
3
|
-
|
|
4
|
-
# 2. CREATE YOUR FIRST PROJECT
|
|
5
|
-
kuhul-es init my-first-kuhul-game
|
|
6
|
-
|
|
7
|
-
# 3. NAVIGATE TO PROJECT
|
|
8
|
-
cd my-first-kuhul-game
|
|
9
|
-
|
|
10
|
-
# 4. INSTALL DEPENDENCIES
|
|
11
|
-
npm install
|
|
12
|
-
|
|
13
|
-
# 5. RUN THE EXAMPLE
|
|
14
|
-
npm start
|
package/server.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// server.js
|
|
2
|
-
const { KUHULRuntimeNode } = require('kuhul-es');
|
|
3
|
-
|
|
4
|
-
const runtime = new KUHULRuntimeNode();
|
|
5
|
-
|
|
6
|
-
const simulation = `
|
|
7
|
-
π system = {
|
|
8
|
-
name: "Orbital Mechanics",
|
|
9
|
-
bodies: [
|
|
10
|
-
{ name: "Sun", mass: 1000, x: 0, y: 0, vx: 0, vy: 0 },
|
|
11
|
-
{ name: "Earth", mass: 1, x: 100, y: 0, vx: 0, vy: 2.5 },
|
|
12
|
-
{ name: "Mars", mass: 0.5, x: 150, y: 0, vx: 0, vy: 2.0 }
|
|
13
|
-
]
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
τ time = 0;
|
|
17
|
-
τ steps = 0;
|
|
18
|
-
|
|
19
|
-
function* simulate() {
|
|
20
|
-
yield* Sek('log', 'Starting orbital simulation...');
|
|
21
|
-
|
|
22
|
-
@while (time < 100) {
|
|
23
|
-
// Calculate gravitational forces
|
|
24
|
-
@for (const a of system.bodies) {
|
|
25
|
-
@for (const b of system.bodies) {
|
|
26
|
-
@if (a !== b) {
|
|
27
|
-
π dx = b.x - a.x;
|
|
28
|
-
π dy = b.y - a.y;
|
|
29
|
-
π distance = Math.sqrt(dx*dx + dy*dy);
|
|
30
|
-
π force = (a.mass * b.mass) / (distance * distance);
|
|
31
|
-
|
|
32
|
-
a.vx += (force * dx / distance) / a.mass * 0.01;
|
|
33
|
-
a.vy += (force * dy / distance) / a.mass * 0.01;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Update positions
|
|
39
|
-
@for (const body of system.bodies) {
|
|
40
|
-
body.x += body.vx * 0.1;
|
|
41
|
-
body.y += body.vy * 0.1;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
time += 0.1;
|
|
45
|
-
steps += 1;
|
|
46
|
-
|
|
47
|
-
@if (steps % 100 === 0) {
|
|
48
|
-
yield* Sek('log', \`Time: \${time.toFixed(1)}, Steps: \${steps}\`);
|
|
49
|
-
yield* Sek('log', \`Earth position: (\${system.bodies[1].x.toFixed(1)}, \${system.bodies[1].y.toFixed(1)})\`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
yield* Sek('log', 'Simulation complete!');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
simulate();
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
runtime.execute(simulation);
|
package/setup-npm.ps1
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# simple-setup.ps1 - Even simpler version
|
|
2
|
-
Write-Host "=== NPM Setup for KUHUL-ES ===" -ForegroundColor Green
|
|
3
|
-
|
|
4
|
-
# 1. Check if npm exists
|
|
5
|
-
if (Get-Command npm -ErrorAction SilentlyContinue) {
|
|
6
|
-
Write-Host "✓ NPM is installed" -ForegroundColor Green
|
|
7
|
-
} else {
|
|
8
|
-
Write-Host "✗ NPM not found. Install Node.js from nodejs.org" -ForegroundColor Red
|
|
9
|
-
exit 1
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
# 2. Check if already logged in
|
|
13
|
-
npm whoami 2>$null
|
|
14
|
-
if ($LASTEXITCODE -eq 0) {
|
|
15
|
-
$user = npm whoami
|
|
16
|
-
Write-Host "✓ Already logged in as: $user" -ForegroundColor Green
|
|
17
|
-
} else {
|
|
18
|
-
Write-Host "Not logged in to NPM" -ForegroundColor Yellow
|
|
19
|
-
|
|
20
|
-
# Simple token setup
|
|
21
|
-
$token = Read-Host "Enter your NPM token (or press Enter to skip)"
|
|
22
|
-
|
|
23
|
-
if ($token) {
|
|
24
|
-
# Save to environment
|
|
25
|
-
$env:NPM_TOKEN = $token
|
|
26
|
-
|
|
27
|
-
# Save to .npmrc
|
|
28
|
-
"//registry.npmjs.org/:_authToken=$token" | Out-File "$HOME\.npmrc"
|
|
29
|
-
|
|
30
|
-
Write-Host "✓ Token saved to .npmrc" -ForegroundColor Green
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# 3. Test
|
|
35
|
-
Write-Host ""
|
|
36
|
-
Write-Host "Testing..." -ForegroundColor Cyan
|
|
37
|
-
npm whoami
|
|
38
|
-
|
|
39
|
-
Write-Host ""
|
|
40
|
-
Write-Host "Done! Run: npm publish --access public" -ForegroundColor Green
|
package//317/200-Bindings.js
DELETED