mystic-yard 2.0.0 → 2.0.2
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/compiler.js +22 -11
- package/package.json +1 -1
package/compiler.js
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
1
4
|
const scanner = require("./compiler/scanner");
|
|
2
5
|
const parser = require("./compiler/parser");
|
|
3
6
|
const writer = require("./compiler/writer");
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
// 🌟 নতুন যুক্ত করা স্বয়ংক্রিয় রানার ফাংশন (আগের কোনো কোড পরিবর্তন না করে)
|
|
9
|
+
function initFramework() {
|
|
10
|
+
const files = scanner();
|
|
11
|
+
|
|
12
|
+
console.log("Files:", files);
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
console.log("Reading:", file.name);
|
|
16
|
+
console.log("Code:", file.code);
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
console.log("Code:", file.code);
|
|
18
|
+
const tokens = file.code.split(/\s+/);
|
|
19
|
+
console.log("Tokens:", tokens);
|
|
12
20
|
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
const jsCode = parser(tokens);
|
|
22
|
+
console.log("Generated JS:", jsCode);
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
writer(jsCode, "./dist/output.js");
|
|
25
|
+
}
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
console.log("Compilation complete!");
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
// আপনার আগের কোডের সব ফাংশনালিটি অক্ষুণ্ণ রেখে এক্সপোর্ট করা হলো
|
|
31
|
+
module.exports = {
|
|
32
|
+
init: initFramework
|
|
33
|
+
};
|