nirguna 0.1.0 → 0.1.1
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/ChangeLog +17 -17
- package/README.md +12 -10
- package/lib/nirguna.js +66 -0
- package/package.json +1 -1
- package/lib/ishvara.js +0 -29
- /package/bin/{ishvara.js → nirguna.js} +0 -0
package/ChangeLog
CHANGED
|
@@ -18,36 +18,36 @@ feature:
|
|
|
18
18
|
- fab315c ishvara: v86 v0.5.319
|
|
19
19
|
- cdaebc9 ishvara: update dependencies
|
|
20
20
|
- e9c308e nemesis: gets
|
|
21
|
-
- 96bcd68 @
|
|
21
|
+
- 96bcd68 @nirguna/plugin-fasm: extract-labele-blocks: nested
|
|
22
22
|
|
|
23
23
|
2025.07.25, v2.13.3
|
|
24
24
|
|
|
25
25
|
feature:
|
|
26
|
-
- 7c0c12c @
|
|
26
|
+
- 7c0c12c @nirguna/plugin-fasm: extract-labele-blocks: nested
|
|
27
27
|
|
|
28
28
|
2025.07.24, v2.13.2
|
|
29
29
|
|
|
30
30
|
fix:
|
|
31
|
-
- 4c4d3c1 @
|
|
31
|
+
- 4c4d3c1 @nirguna/plugin-fasm: convert-args-to-regs
|
|
32
32
|
|
|
33
33
|
feature:
|
|
34
|
-
- 6dd1438 @
|
|
34
|
+
- 6dd1438 @nirguna/operator-fasm: globals
|
|
35
35
|
|
|
36
36
|
2025.07.23, v2.13.1
|
|
37
37
|
|
|
38
38
|
feature:
|
|
39
|
-
- ed31929 @
|
|
39
|
+
- ed31929 @nirguna/plugin-fasm: remove-useless-promise
|
|
40
40
|
|
|
41
41
|
2025.07.22, v2.13.0
|
|
42
42
|
|
|
43
43
|
feature:
|
|
44
|
-
- 3980a88 @
|
|
44
|
+
- 3980a88 @nirguna/operator-nemesis: add
|
|
45
45
|
|
|
46
46
|
2025.07.22, v2.12.7
|
|
47
47
|
|
|
48
48
|
feature:
|
|
49
|
-
- 28cb12b @
|
|
50
|
-
- 9757627 @
|
|
49
|
+
- 28cb12b @nirguna/plugin-fasm: convert-do-while-to-jnz: break
|
|
50
|
+
- 9757627 @nirguna/plugin-nemesis: convert-find-first-to-int-0xff: add
|
|
51
51
|
|
|
52
52
|
2025.07.20, v2.12.6
|
|
53
53
|
|
|
@@ -58,7 +58,7 @@ feature:
|
|
|
58
58
|
|
|
59
59
|
feature:
|
|
60
60
|
- 828cb35 @putout/plugin-fasm: convert-assign-to-move: constants
|
|
61
|
-
- e2f186e @
|
|
61
|
+
- e2f186e @nirguna/transformer-fasm: remove-useless-operand: add
|
|
62
62
|
|
|
63
63
|
2025.07.19, v2.12.4
|
|
64
64
|
|
|
@@ -68,7 +68,7 @@ feature:
|
|
|
68
68
|
2025.07.19, v2.12.3
|
|
69
69
|
|
|
70
70
|
feature:
|
|
71
|
-
- 37d096a @
|
|
71
|
+
- 37d096a @nirguna/plugin-nemesis: colors
|
|
72
72
|
|
|
73
73
|
2025.07.19, v2.12.2
|
|
74
74
|
|
|
@@ -89,7 +89,7 @@ feature:
|
|
|
89
89
|
2025.07.17, v2.11.1
|
|
90
90
|
|
|
91
91
|
feature:
|
|
92
|
-
- 12ddc96 @
|
|
92
|
+
- 12ddc96 @nirguna/plugin-nemesis: convert-gets-to-0xff
|
|
93
93
|
- cfb743f nemesis: sector: rm useless push
|
|
94
94
|
|
|
95
95
|
2025.07.15, v2.11.0
|
|
@@ -101,12 +101,12 @@ feature:
|
|
|
101
101
|
|
|
102
102
|
feature:
|
|
103
103
|
- ca49e32 plugin-bundler-fasm: replace-section-code-with-functions: exclude start
|
|
104
|
-
- f305e8f @
|
|
104
|
+
- f305e8f @nirguna/runner/fasm: externals
|
|
105
105
|
|
|
106
106
|
2025.07.14, v2.10.2
|
|
107
107
|
|
|
108
108
|
fix:
|
|
109
|
-
- bffa9f5 @
|
|
109
|
+
- bffa9f5 @nirguna-plugin-fasm: convert-while-to-js: jz -> jnz
|
|
110
110
|
|
|
111
111
|
2025.07.13, v2.10.1
|
|
112
112
|
|
|
@@ -122,8 +122,8 @@ feature:
|
|
|
122
122
|
2025.07.12, v2.9.0
|
|
123
123
|
|
|
124
124
|
feature:
|
|
125
|
-
- d98cffc @
|
|
126
|
-
- 9dda9f1 @
|
|
125
|
+
- d98cffc @nirguna/format-floppy: add
|
|
126
|
+
- 9dda9f1 @nirguna/format-floppy: add
|
|
127
127
|
- 1cb5e1a plugin-fasm: switch-cmp-operands: add
|
|
128
128
|
|
|
129
129
|
2025.07.11, v2.8.11
|
|
@@ -201,7 +201,7 @@ feature:
|
|
|
201
201
|
feature:
|
|
202
202
|
- cc0e458 ishvara: plugin-optimizer-fasm: apply-lodsb
|
|
203
203
|
- 59739ca runner-wasm: tests
|
|
204
|
-
- 77e12ac @
|
|
204
|
+
- 77e12ac @nirguna/test: add
|
|
205
205
|
|
|
206
206
|
2025.06.27, v2.7.3
|
|
207
207
|
|
|
@@ -239,7 +239,7 @@ feature:
|
|
|
239
239
|
feature:
|
|
240
240
|
- 6156f74 ishvara: plugin-fasm: convert-arguments-to-registers: add esp -> ret size
|
|
241
241
|
- 8095442 nemesis: find-file
|
|
242
|
-
- 2c11137 @
|
|
242
|
+
- 2c11137 @nirguna/plugin-fasm: convert-const-to-equ
|
|
243
243
|
- c3c694e plugin-fasm: convet-do-while-to-jnz: false
|
|
244
244
|
|
|
245
245
|
2025.06.23, v2.6.1
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Ishvara
|
|
2
2
|
|
|
3
|
-

|
|
4
|
+
|
|
5
|
+
> Nirguna (Sanskrit: निर्गुण) refers to the supreme, ultimate reality (Brahman) in Hinduism and other Indian philosophies as being without form, material attributes, or limitations (derived from nir, meaning "without," and guna, meaning "quality" or "attribute"). It signifies a transcendental, non-dual, and ineffable state of being
|
|
4
6
|
|
|
5
7
|
Compile JavaScript to WASM and Fasm.
|
|
6
8
|
|
|
@@ -9,7 +11,7 @@ Compile JavaScript to WASM and Fasm.
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
11
13
|
```
|
|
12
|
-
npm i
|
|
14
|
+
npm i nirguna -g
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Usage Example
|
|
@@ -32,13 +34,13 @@ You can compile it to fasm and wasm.
|
|
|
32
34
|
Let's compile javascript with:
|
|
33
35
|
|
|
34
36
|
```sh
|
|
35
|
-
|
|
37
|
+
nirguna --target fasm example/fn.ts -o code
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
To intermediate representation:
|
|
39
41
|
|
|
40
42
|
```js
|
|
41
|
-
|
|
43
|
+
__nirguna_add: {
|
|
42
44
|
mov(eax, 0x1);
|
|
43
45
|
mov(ebx, 0x2);
|
|
44
46
|
add(eax, ebx);
|
|
@@ -49,20 +51,20 @@ __ishvara_add: {
|
|
|
49
51
|
Also we can compile it with:
|
|
50
52
|
|
|
51
53
|
```sh
|
|
52
|
-
|
|
54
|
+
nirguna -t fasm example/fn.ts -o code
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
to assembly representation with:
|
|
56
58
|
|
|
57
59
|
```asm
|
|
58
|
-
|
|
60
|
+
__nirguna_add:
|
|
59
61
|
mov eax, 0x1
|
|
60
62
|
mov ebx, 0x2
|
|
61
63
|
add eax, ebx
|
|
62
64
|
ret
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
Also we can compile it to binary representation with `
|
|
67
|
+
Also we can compile it to binary representation with `nirguna fasm example/fn.ts`:
|
|
66
68
|
|
|
67
69
|
```sh
|
|
68
70
|
$ hexdump example/fn.bin
|
|
@@ -76,7 +78,7 @@ $ hexdump example/fn.bin
|
|
|
76
78
|
Let's suppose we have absolutely valid JavaScript file with types, which we can run with node v24.
|
|
77
79
|
|
|
78
80
|
```ts
|
|
79
|
-
import {create} from '#
|
|
81
|
+
import {create} from '#nirguna';
|
|
80
82
|
|
|
81
83
|
export const stack = [];
|
|
82
84
|
|
|
@@ -101,7 +103,7 @@ export function x(a: i32, b: i32): i32 {
|
|
|
101
103
|
}
|
|
102
104
|
```
|
|
103
105
|
|
|
104
|
-
Compiled with `
|
|
106
|
+
Compiled with `nirguna 1.wast.ts` to `1.wast`:
|
|
105
107
|
|
|
106
108
|
```wast
|
|
107
109
|
(module
|
|
@@ -116,7 +118,7 @@ Compiled with `ishvara 1.wast.ts` to `1.wast`:
|
|
|
116
118
|
With:
|
|
117
119
|
|
|
118
120
|
```js
|
|
119
|
-
import {compile} from '
|
|
121
|
+
import {compile} from 'nirguna';
|
|
120
122
|
|
|
121
123
|
const wast = compile(wastts);
|
|
122
124
|
const binary = await translate(wast);
|
package/lib/nirguna.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {test} from 'supertape';
|
|
2
|
+
import montag from 'montag';
|
|
3
|
+
import {compile} from '#ishvara';
|
|
4
|
+
|
|
5
|
+
test('ishvara: asm', async (t) => {
|
|
6
|
+
const source = 'eax = 1';
|
|
7
|
+
const [result] = await compile(source, {
|
|
8
|
+
target: 'asm',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const expected = montag`
|
|
12
|
+
xor eax, eax
|
|
13
|
+
inc eax\n
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
t.equal(result, expected);
|
|
17
|
+
t.end();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('ishvara: asm: config', async (t) => {
|
|
21
|
+
const source = 'const a = 2; eax = 1';
|
|
22
|
+
const [result] = await compile(source, {
|
|
23
|
+
target: 'asm',
|
|
24
|
+
config: {
|
|
25
|
+
plugins: [
|
|
26
|
+
'remove-unused-variables',
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const expected = montag`
|
|
32
|
+
xor eax, eax
|
|
33
|
+
inc eax
|
|
34
|
+
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
t.equal(result, expected);
|
|
38
|
+
t.end();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('ishvara: wasm: onStageChanged', async (t) => {
|
|
42
|
+
const source = 'function add(a, b) {return a + b};\n';
|
|
43
|
+
const result = [];
|
|
44
|
+
const onStageChange = (a, b) => result.push([a, b]);
|
|
45
|
+
|
|
46
|
+
await compile(source, {
|
|
47
|
+
type: 'optimized',
|
|
48
|
+
optimization: false,
|
|
49
|
+
onStageChange,
|
|
50
|
+
target: 'wasm',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const expected = [
|
|
54
|
+
['transform', {
|
|
55
|
+
last: false,
|
|
56
|
+
places: [],
|
|
57
|
+
}],
|
|
58
|
+
['optimize', {
|
|
59
|
+
last: true,
|
|
60
|
+
places: [],
|
|
61
|
+
}],
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
t.deepEqual(result, expected);
|
|
65
|
+
t.end();
|
|
66
|
+
});
|
package/package.json
CHANGED
package/lib/ishvara.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as wasm from '#compiler-wasm';
|
|
2
|
-
import * as fasm from '#compiler-fasm';
|
|
3
|
-
|
|
4
|
-
export const compile = async (source, options) => {
|
|
5
|
-
const {
|
|
6
|
-
target,
|
|
7
|
-
type,
|
|
8
|
-
name,
|
|
9
|
-
optimization,
|
|
10
|
-
config,
|
|
11
|
-
onStageChange,
|
|
12
|
-
} = options;
|
|
13
|
-
|
|
14
|
-
if (target === 'wasm')
|
|
15
|
-
return await wasm.compile(source, {
|
|
16
|
-
type,
|
|
17
|
-
name,
|
|
18
|
-
optimization,
|
|
19
|
-
onStageChange,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return await fasm.compile(source, {
|
|
23
|
-
type,
|
|
24
|
-
target,
|
|
25
|
-
optimization,
|
|
26
|
-
config,
|
|
27
|
-
onStageChange,
|
|
28
|
-
});
|
|
29
|
-
};
|
|
File without changes
|