nomen-lang 0.0.19 → 0.1.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/NOMEN_AGENTS.md +56 -11
- package/core/System/Array.nm +11 -11
- package/core/System/Channel.nm +146 -12
- package/core/System/Console.nm +28 -17
- package/core/System/Controls/Button.nm +96 -8
- package/core/System/Controls/CheckBox.nm +117 -12
- package/core/System/Controls/Container.nm +114 -8
- package/core/System/Controls/Text.nm +98 -8
- package/core/System/Controls/TextBox.nm +120 -10
- package/core/System/Controls/Window.nm +231 -23
- package/core/System/Init.nm +4 -8
- package/core/System/Math.nm +10 -32
- package/core/System/Result.nm +1 -1
- package/core/System/Stream/Directory.nm +189 -63
- package/core/System/Stream/DirectoryError.nm +21 -0
- package/core/System/Stream/File.nm +339 -141
- package/core/System/Stream/FileError.nm +21 -0
- package/core/System/Stream/Http.nm +109 -44
- package/core/System/Stream/HttpError.nm +20 -0
- package/core/System/String.nm +83 -69
- package/core/System/StringBuilder.nm +11 -13
- package/core/System/Task.nm +46 -12
- package/core/System/Test.nm +1 -1
- package/core/System/Text/Json.nm +5 -3
- package/core/System/Text/JsonTree.nm +23 -14
- package/core/System/Text/Regex.nm +124 -64
- package/core/System/bool.nm +4 -9
- package/core/System/char.nm +3 -9
- package/core/System/float.nm +2 -1
- package/core/System/float32.nm +44 -0
- package/core/System/float64.nm +44 -0
- package/core/System/int.nm +3 -9
- package/core/System/int16.nm +47 -0
- package/core/System/int32.nm +47 -0
- package/core/System/int64.nm +3 -9
- package/core/System/int8.nm +3 -9
- package/core/System/ufloat.nm +44 -0
- package/core/System/ufloat32.nm +44 -0
- package/core/System/ufloat64.nm +44 -0
- package/core/System/uint.nm +3 -9
- package/core/System/uint16.nm +47 -0
- package/core/System/uint32.nm +47 -0
- package/core/System/uint64.nm +3 -9
- package/core/System/uint8.nm +3 -9
- package/core/docs/System/Channel.md +2 -0
- package/core/docs/System/Result.md +5 -1
- package/core/docs/System/Task.md +1 -1
- package/dist/index.mjs +32686 -15301
- package/package.json +38 -34
- package/src/args.ts +11 -0
- package/src/index.ts +15 -2
- package/src/init.ts +1 -1
- package/src/test.ts +1 -1
- package/src/types/Config.ts +2 -0
package/package.json
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
"name": "nomen-lang",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The CLI for the Nomen programming language.",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"author": "",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/andrewjk/nomen",
|
|
11
|
+
"directory": "cli"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"nomen": "dist/index.mjs"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src",
|
|
19
|
+
"core",
|
|
20
|
+
"NOMEN_AGENTS.md"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^26.2.0",
|
|
25
|
+
"chokidar": "^5.0.0",
|
|
26
|
+
"tsx": "^4.23.12",
|
|
27
|
+
"typescript": "^7.0.2",
|
|
28
|
+
"vite-plus": "0.2.9"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "node scripts/bundle-assets.mjs && vp pack",
|
|
32
|
+
"dev": "node scripts/bundle-assets.mjs && vp pack --watch",
|
|
33
|
+
"test": "vp test",
|
|
34
|
+
"check": "vp check",
|
|
35
|
+
"format": "vp check --fix",
|
|
36
|
+
"go": "tsx src/index.ts",
|
|
37
|
+
"register": "pnpm build && pnpm add -g ."
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/args.ts
CHANGED
|
@@ -12,6 +12,10 @@ export interface Args {
|
|
|
12
12
|
audit: boolean;
|
|
13
13
|
audit_runtime?: string;
|
|
14
14
|
check: boolean;
|
|
15
|
+
release: boolean;
|
|
16
|
+
/** Opt in to FP reassociation: float reductions vectorize under NEON
|
|
17
|
+
* (results may differ in the last ulp vs the scalar loop). */
|
|
18
|
+
fast_math: boolean;
|
|
15
19
|
// Everything after a bare `--` on the command line — forwarded verbatim to
|
|
16
20
|
// the compiled program by `nomen run`. Lets a program receive its own argv
|
|
17
21
|
// (`nomen run --in app/main.nm -- arg1 arg2`).
|
|
@@ -42,6 +46,9 @@ const BOOLEAN_OPTIONS: Map<string, string> = new Map([
|
|
|
42
46
|
["w", "watch"],
|
|
43
47
|
["audit", "audit"],
|
|
44
48
|
["check", "check"],
|
|
49
|
+
["release", "release"],
|
|
50
|
+
["r", "release"],
|
|
51
|
+
["fast-math", "fast_math"],
|
|
45
52
|
]);
|
|
46
53
|
|
|
47
54
|
const DEFAULTS: Partial<Args> = {
|
|
@@ -49,6 +56,8 @@ const DEFAULTS: Partial<Args> = {
|
|
|
49
56
|
watch: false,
|
|
50
57
|
audit: false,
|
|
51
58
|
check: false,
|
|
59
|
+
release: false,
|
|
60
|
+
fast_math: false,
|
|
52
61
|
};
|
|
53
62
|
|
|
54
63
|
function set(args: Args, key: string, value: string | boolean): void {
|
|
@@ -166,6 +175,8 @@ export function print_help(): void {
|
|
|
166
175
|
" --lib, -l <path> Path to System library directory (containing package.jsonc)",
|
|
167
176
|
" --audit Audit the generated program for memory issues",
|
|
168
177
|
" --audit-runtime <path> Path to audit_runtime.c, linked in when --audit is set",
|
|
178
|
+
" --release, -r Build with optimizations (clang -O2; asm passes on aarch64)",
|
|
179
|
+
" --fast-math Allow FP reassociation (float loop reductions vectorize on aarch64)",
|
|
169
180
|
" --check For `nomen format`: report files that would change",
|
|
170
181
|
" -h, --help Show this help",
|
|
171
182
|
].join("\n"),
|
package/src/index.ts
CHANGED
|
@@ -163,6 +163,8 @@ try {
|
|
|
163
163
|
if (args.lib) config.lib = args.lib;
|
|
164
164
|
if (args.audit) config.audit = args.audit;
|
|
165
165
|
if (args.audit_runtime) config.audit_runtime = args.audit_runtime;
|
|
166
|
+
if (args.release) config.release = args.release;
|
|
167
|
+
if (args.fast_math) config.fast_math = args.fast_math;
|
|
166
168
|
|
|
167
169
|
// Is the --in path a folder
|
|
168
170
|
if (fs.lstatSync(args.in).isDirectory()) {
|
|
@@ -349,7 +351,13 @@ function processFile(filename: string, config: Config, mode: Mode, program_args:
|
|
|
349
351
|
return;
|
|
350
352
|
}
|
|
351
353
|
|
|
352
|
-
const result = build(parsed.root, {
|
|
354
|
+
const result = build(parsed.root, {
|
|
355
|
+
arch,
|
|
356
|
+
platform,
|
|
357
|
+
audit: config.audit,
|
|
358
|
+
optimize: config.release,
|
|
359
|
+
fast_math: config.fast_math,
|
|
360
|
+
});
|
|
353
361
|
|
|
354
362
|
if (result.errors && result.errors.length > 0) {
|
|
355
363
|
console.log(render_errors(input, result.errors));
|
|
@@ -391,7 +399,12 @@ function processFile(filename: string, config: Config, mode: Mode, program_args:
|
|
|
391
399
|
platform === "macos" || platform === "ios"
|
|
392
400
|
? " -framework CoreGraphics -framework Foundation -framework AppKit -lobjc"
|
|
393
401
|
: "";
|
|
394
|
-
|
|
402
|
+
// Release mode compiles the C (and aarch64 companion C) with -O2,
|
|
403
|
+
// matching the optimized builds other toolchains produce by default.
|
|
404
|
+
// The aarch64 .s itself is assembled verbatim — its optimizations are
|
|
405
|
+
// the codegen passes enabled via `optimize` above.
|
|
406
|
+
const opt_flags = config.release ? " -O2" : "";
|
|
407
|
+
execSync(`clang${opt_flags} -o ${outfile} ${link_inputs}${framework_flags}`);
|
|
395
408
|
|
|
396
409
|
if (mode === "build") {
|
|
397
410
|
const buildTime = performance.now();
|
package/src/init.ts
CHANGED
package/src/test.ts
CHANGED
|
@@ -183,7 +183,7 @@ export function generate_harness(tests: TestFunction[], benches: BenchFunction[]
|
|
|
183
183
|
})
|
|
184
184
|
.join("\n");
|
|
185
185
|
|
|
186
|
-
let main = "\nimport System\nimport System
|
|
186
|
+
let main = "\nimport System\nimport System::Test\n\npub func main = () {\n";
|
|
187
187
|
main += "\tvar Tester t = Tester()\n";
|
|
188
188
|
for (const test of tests) {
|
|
189
189
|
main += `\tt.begin_test("${escape_nm_string(test.name)}")\n`;
|