bayda-maghreb 1.1.4 → 1.1.6
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 +4 -0
- package/bayda-transpile.cjs +34 -0
- package/data/dialects/algeria.json +1 -1
- package/data/dialects/algeria_franco.json +97 -40
- package/data/dialects/kabyle-latin.json +4 -7
- package/data/dialects/libya.json +18 -21
- package/data/dialects/mauritania.json +177 -177
- package/data/dialects/tunisia_franco.json +84 -3
- package/index.js +10 -2
- package/package.json +35 -6
- package/.gitignor +0 -1
- package/core/ast.ts +0 -1
- package/core/compile.ts +0 -1
- package/core/lexer.ts +0 -4
- package/core/loader.ts +0 -1
- package/core/mapping.ts +0 -1
- package/core/normalizer.ts +0 -1
- package/core/parser.ts +0 -1
- package/core/schema.ts +0 -1
- package/core/types.ts +0 -1
- package/data/dialects/kab.json +0 -74
- package/examples/hello.kab +0 -1
- package/examples/hello.ly +0 -1
- package/expected/hello.kab.txt +0 -1
- package/expected/hello.ly.txt +0 -1
- package/hello.kab.bayda +0 -9
- package/index.html +0 -33
- package/run-kab.js +0 -15
- package/test.kab.bayda +0 -3
- package/test.mjs +0 -9
- package/tests/core/lexer.test.ts +0 -3
- package/tests/core/parser.test.ts +0 -3
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -2
- package/writers/python-writer.ts +0 -1
- package//330/263/330/261 +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const fs=require('fs');
|
|
2
|
+
const _cache=new Map();
|
|
3
|
+
const _esc=s=>s.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');
|
|
4
|
+
const _skip=/("(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`|\/\/[^\n]*|\/\*[\s\S]*?\*\/)/;
|
|
5
|
+
function _load(file){
|
|
6
|
+
const key=file+':'+fs.statSync(file).mtimeMs;
|
|
7
|
+
if(_cache.has(key)) return _cache.get(key);
|
|
8
|
+
const data=JSON.parse(fs.readFileSync(file,'utf8'));
|
|
9
|
+
const map=new Map();
|
|
10
|
+
const CORE=new Set('if else while for break continue function return true false null let const switch import export class new try catch finally throw await async'.split(' '));
|
|
11
|
+
const LIB=new Set('Array String Number Object Boolean filter map reduce find push pop console.log sort replace split join stringify promise error call apply bind global module process prompt length'.split(' '));
|
|
12
|
+
const ALIAS={print:'console.log',log:'console.log'};
|
|
13
|
+
if(data.keywords) for(const [w,c] of Object.entries(data.keywords)){
|
|
14
|
+
const js=ALIAS[c]||c;
|
|
15
|
+
if(w.length>1&&(CORE.has(js)||LIB.has(js))&&!map.has(w)) map.set(w,js);
|
|
16
|
+
}
|
|
17
|
+
for(const k of ['core','library']){
|
|
18
|
+
const sec=data[k];
|
|
19
|
+
if(!sec) continue;
|
|
20
|
+
for(const js in sec) for(const w of sec[js]) if(w&&w.length>1&&!map.has(w)) map.set(w,js);
|
|
21
|
+
}
|
|
22
|
+
if(!map.size) throw new Error('no core/library words in '+file);
|
|
23
|
+
const alt=[...map.keys()].sort((a,b)=>b.length-a.length).map(_esc).join('|');
|
|
24
|
+
const re=new RegExp('(?<![\\p{L}\\p{N}_])('+alt+')(?![\\p{L}\\p{N}_])','gu');
|
|
25
|
+
const r={map,re};
|
|
26
|
+
_cache.set(key,r);
|
|
27
|
+
return r;
|
|
28
|
+
}
|
|
29
|
+
function transpile(code,file){
|
|
30
|
+
const {map,re}=_load(file);
|
|
31
|
+
return String(code).split(_skip).map((p,i)=>i%2?p:p.replace(re,m=>map.get(m))).join('').trim();
|
|
32
|
+
}
|
|
33
|
+
module.exports=transpile;
|
|
34
|
+
module.exports.transpile=transpile;
|
|
@@ -3,49 +3,106 @@
|
|
|
3
3
|
"code": "dz-latn",
|
|
4
4
|
"script": "Latin",
|
|
5
5
|
"keywords": {
|
|
6
|
-
"ila": "if",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
6
|
+
"ila": "if",
|
|
7
|
+
"loukan": "if",
|
|
8
|
+
"kan": "if",
|
|
9
|
+
"ki": "if",
|
|
10
|
+
"bsah": "else",
|
|
11
|
+
"w_ila": "else",
|
|
12
|
+
"ella": "else",
|
|
13
|
+
"w_ila_kan": "elif",
|
|
14
|
+
"ella_kan": "elif",
|
|
15
|
+
"toul_ma": "while",
|
|
16
|
+
"madaam": "while",
|
|
10
17
|
"dir": "do",
|
|
11
|
-
"dour": "for",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
18
|
+
"dour": "for",
|
|
19
|
+
"lef": "for",
|
|
20
|
+
"7abbes": "break",
|
|
21
|
+
"9oss": "break",
|
|
22
|
+
"fawet": "continue",
|
|
23
|
+
"jouz": "continue",
|
|
24
|
+
"khlas": "end",
|
|
25
|
+
"kamal": "end",
|
|
26
|
+
"s7i7": "true",
|
|
27
|
+
"sah": "true",
|
|
16
28
|
"ghalet": "false",
|
|
17
|
-
"w": "and",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
29
|
+
"w": "and",
|
|
30
|
+
"wella": "or",
|
|
31
|
+
"machi": "not",
|
|
32
|
+
"bayen": "print",
|
|
33
|
+
"wari": "print",
|
|
34
|
+
"tba3": "print",
|
|
35
|
+
"jib": "input",
|
|
36
|
+
"da5al": "input",
|
|
37
|
+
"a9ra": "input",
|
|
38
|
+
"raja3": "return",
|
|
39
|
+
"welli": "return",
|
|
40
|
+
"7aja": "variable",
|
|
41
|
+
"3afsa": "variable",
|
|
42
|
+
"tabet": "constant",
|
|
43
|
+
"mssamar": "constant",
|
|
23
44
|
"lista": "array_list",
|
|
24
|
-
"5awi": "null_empty",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
45
|
+
"5awi": "null_empty",
|
|
46
|
+
"makach": "null_empty",
|
|
47
|
+
"walou": "null_empty",
|
|
48
|
+
"fargh": "null_empty",
|
|
49
|
+
"msa7": "clear_delete",
|
|
50
|
+
"n9i": "clear_delete",
|
|
51
|
+
"khedma": "function_method",
|
|
52
|
+
"fonction": "function_method",
|
|
53
|
+
"ch3al": "run_execute",
|
|
54
|
+
"5adem": "run_execute",
|
|
55
|
+
"sajal": "save_commit",
|
|
56
|
+
"5abi": "save_commit",
|
|
57
|
+
"7awes": "debug",
|
|
58
|
+
"bag": "error_bug",
|
|
59
|
+
"ta7": "crash",
|
|
60
|
+
"tamet": "success",
|
|
61
|
+
"sal7at": "success",
|
|
62
|
+
"naja7": "success",
|
|
63
|
+
"forma": "class",
|
|
64
|
+
"9aleb": "class",
|
|
65
|
+
"noskha": "clone",
|
|
66
|
+
"ferkh": "object",
|
|
67
|
+
"wart": "inheritance",
|
|
68
|
+
"zbel": "garbage_collector",
|
|
69
|
+
"bab": "port",
|
|
70
|
+
"rawchen": "api_endpoint",
|
|
71
|
+
"ab3at": "request",
|
|
72
|
+
"dez": "request",
|
|
73
|
+
"jawb": "response",
|
|
74
|
+
"fet_lwa9t": "timeout",
|
|
75
|
+
"sirfer": "server",
|
|
76
|
+
"tla9": "deploy",
|
|
77
|
+
"5azen": "backup",
|
|
78
|
+
"khalat": "merge",
|
|
79
|
+
"dfa3": "push",
|
|
80
|
+
"jbad": "pull",
|
|
81
|
+
"dour_bla_7sab": "infinite_loop",
|
|
82
|
+
"estana": "loading_spinner",
|
|
83
|
+
"3ando_daw_a5dar": "authorized",
|
|
84
|
+
"mbloki": "blocked_banned",
|
|
85
|
+
"m7abbes": "freeze_not_responding",
|
|
86
|
+
"or9od": "delay_sleep",
|
|
87
|
+
"chifra": "password",
|
|
88
|
+
"sara9": "hacker",
|
|
89
|
+
"5azna": "database",
|
|
90
|
+
"7awes_fi_dfater": "query",
|
|
91
|
+
"basma": "primary_key",
|
|
92
|
+
"sas": "framework",
|
|
93
|
+
"fabor": "open_source",
|
|
94
|
+
"3andi": "localhost",
|
|
95
|
+
"lfoug": "cloud",
|
|
96
|
+
"far3": "branch",
|
|
97
|
+
"tkhalatet": "conflict",
|
|
98
|
+
"welli_kima_kan": "rollback",
|
|
99
|
+
"batma": "button",
|
|
100
|
+
"da5el": "padding",
|
|
101
|
+
"barra": "margin",
|
|
102
|
+
"t3ayet_lro7ha": "recursion",
|
|
103
|
+
"s7i7_wla_la": "boolean",
|
|
104
|
+
"rateb": "sort",
|
|
105
|
+
"safi": "filter"
|
|
49
106
|
},
|
|
50
107
|
"symbols": {}
|
|
51
108
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"code": "kab",
|
|
2
|
+
"code": "kab-lat",
|
|
3
3
|
"name": "Kabyle",
|
|
4
4
|
"keywords": {
|
|
5
5
|
"ila": "if",
|
|
6
6
|
"ma_yella": "if",
|
|
7
7
|
"awla": "else",
|
|
8
|
-
"neɣ": "
|
|
8
|
+
"neɣ": "or",
|
|
9
9
|
"ma_ulac": "else",
|
|
10
10
|
"ma_yella_ur": "else if",
|
|
11
11
|
"i": "for",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"rra_d": "return",
|
|
22
22
|
"tidet": "true",
|
|
23
23
|
"tikerkas": "false",
|
|
24
|
-
"ulac": "
|
|
24
|
+
"ulac": "empty",
|
|
25
25
|
"ulac_akra": "null",
|
|
26
26
|
"sider": "import",
|
|
27
27
|
"sufɣ": "export",
|
|
@@ -58,16 +58,14 @@
|
|
|
58
58
|
"awal": "log",
|
|
59
59
|
"seqdec": "sort",
|
|
60
60
|
"beddel": "replace",
|
|
61
|
-
"ferren": "
|
|
61
|
+
"ferren": "parse",
|
|
62
62
|
"seddukel": "join",
|
|
63
63
|
"semsawi": "equal",
|
|
64
64
|
"ameqqran": "greater",
|
|
65
65
|
"ameẓyan": "less",
|
|
66
66
|
"amar": "and",
|
|
67
|
-
"neɣ": "or",
|
|
68
67
|
"ur": "not",
|
|
69
68
|
"yella": "exists",
|
|
70
|
-
"ulac": "empty",
|
|
71
69
|
"seg": "from",
|
|
72
70
|
"ɣer": "to",
|
|
73
71
|
"di": "in",
|
|
@@ -106,7 +104,6 @@
|
|
|
106
104
|
"ini": "say",
|
|
107
105
|
"steqsi": "prompt",
|
|
108
106
|
"wali": "check",
|
|
109
|
-
"ferren": "parse",
|
|
110
107
|
"suɣel": "stringify"
|
|
111
108
|
}
|
|
112
109
|
}
|
package/data/dialects/libya.json
CHANGED
|
@@ -232,25 +232,22 @@
|
|
|
232
232
|
"الكمبيوتر جمد": "freeze_not_responding",
|
|
233
233
|
"دليل العناوين": "dns",
|
|
234
234
|
"شريط الامر": "script",
|
|
235
|
-
"امر الشريط": "script"
|
|
235
|
+
"امر الشريط": "script",
|
|
236
|
+
"لوح في الشاشة": "print",
|
|
237
|
+
"لوّح": "print",
|
|
238
|
+
"لوح": "print",
|
|
239
|
+
"قول": "print",
|
|
240
|
+
"اكتب": "print",
|
|
241
|
+
"اطبع": "print",
|
|
242
|
+
"كتّب": "print",
|
|
243
|
+
"ktab": "print",
|
|
244
|
+
"إذا": "if",
|
|
245
|
+
"كان": "if",
|
|
246
|
+
"وإلا": "else",
|
|
247
|
+
"دير": "for",
|
|
248
|
+
"لين": "while",
|
|
249
|
+
"خطأ": "false",
|
|
250
|
+
"أو": "or"
|
|
236
251
|
},
|
|
237
|
-
"symbols": {}
|
|
238
|
-
|
|
239
|
-
"لوح في الشاشة": "print",
|
|
240
|
-
"لوّح": "print",
|
|
241
|
-
"لوح": "print",
|
|
242
|
-
"قول": "print",
|
|
243
|
-
"اكتب": "print",
|
|
244
|
-
"اطبع": "print",
|
|
245
|
-
"كتّب": "print",
|
|
246
|
-
"ktab": "print",
|
|
247
|
-
"إذا": "if",
|
|
248
|
-
"كان": "if",
|
|
249
|
-
"وإلا": "else",
|
|
250
|
-
"دير": "for",
|
|
251
|
-
"لين": "while",
|
|
252
|
-
"صح": "true",
|
|
253
|
-
"خطأ": "false",
|
|
254
|
-
"و": "and",
|
|
255
|
-
"أو": "or"
|
|
256
|
-
}
|
|
252
|
+
"symbols": {}
|
|
253
|
+
}
|
|
@@ -1,183 +1,183 @@
|
|
|
1
1
|
{
|
|
2
2
|
"code": "mauritania",
|
|
3
3
|
"name": "Mauritanian Hassaniya",
|
|
4
|
-
"nativeName": "حسانية - لغة الشباب و التقنية",
|
|
5
4
|
"keywords": {
|
|
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
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
5
|
+
"أهلا": "hello",
|
|
6
|
+
"هلا": "hi",
|
|
7
|
+
"سلام": "salam",
|
|
8
|
+
"باي": "bye",
|
|
9
|
+
"ميرسي": "thanks",
|
|
10
|
+
"واخا": "ok",
|
|
11
|
+
"أيه": "yes",
|
|
12
|
+
"نو": "no",
|
|
13
|
+
"بليز": "please",
|
|
14
|
+
"كود": "code",
|
|
15
|
+
"بغ": "bug",
|
|
16
|
+
"ديباغي": "debug",
|
|
17
|
+
"صلح": "fix",
|
|
18
|
+
"كوميت": "commit",
|
|
19
|
+
"بوش": "push",
|
|
20
|
+
"بول": "pull",
|
|
21
|
+
"ميرج": "merge",
|
|
22
|
+
"بول ريكويست": "pull_request",
|
|
23
|
+
"ديبلوي": "deploy",
|
|
24
|
+
"سيرفر": "server",
|
|
25
|
+
"كليان": "client",
|
|
26
|
+
"فرونت": "frontend",
|
|
27
|
+
"باك": "backend",
|
|
28
|
+
"فولستاك": "fullstack",
|
|
29
|
+
"أبي": "api",
|
|
30
|
+
"داتا بيز": "database",
|
|
31
|
+
"فريمورك": "framework",
|
|
32
|
+
"ليبراري": "library",
|
|
33
|
+
"فونكسيون": "function",
|
|
34
|
+
"فاريابل": "variable",
|
|
35
|
+
"لوب": "loop",
|
|
36
|
+
"أري": "array",
|
|
37
|
+
"أوبجي": "object",
|
|
38
|
+
"كلاس": "class",
|
|
39
|
+
"أن بي أم": "npm",
|
|
40
|
+
"غيت": "git",
|
|
41
|
+
"غيت هاب": "github",
|
|
42
|
+
"في أس كود": "vscode",
|
|
43
|
+
"إيرور": "error",
|
|
44
|
+
"كراشا": "crash",
|
|
45
|
+
"كومبايل": "compile",
|
|
46
|
+
"بيلد": "build",
|
|
47
|
+
"رنّي": "run",
|
|
48
|
+
"تيست": "test",
|
|
49
|
+
"لوكال هوست": "localhost",
|
|
50
|
+
"دومين": "domain",
|
|
51
|
+
"إبيرجمو": "hosting",
|
|
52
|
+
"كونيكسيون": "internet",
|
|
53
|
+
"ويفي": "wifi",
|
|
54
|
+
"داتا": "data",
|
|
55
|
+
"أونلاين": "online",
|
|
56
|
+
"أوفلاين": "offline",
|
|
57
|
+
"سيت": "website",
|
|
58
|
+
"أبليكاسيون": "app",
|
|
59
|
+
"أب": "application",
|
|
60
|
+
"تيليشارجي": "download",
|
|
61
|
+
"أبلودي": "upload",
|
|
62
|
+
"لين": "link",
|
|
63
|
+
"إيميل": "email",
|
|
64
|
+
"مود باس": "password",
|
|
65
|
+
"يوزرنيم": "username",
|
|
66
|
+
"لوغين": "login",
|
|
67
|
+
"ديكونيكتي": "logout",
|
|
68
|
+
"سجل": "signup",
|
|
69
|
+
"كونت": "account",
|
|
70
|
+
"بروفيل": "profile",
|
|
71
|
+
"بيو": "bio",
|
|
72
|
+
"فولور": "follower",
|
|
73
|
+
"فولونغ": "following",
|
|
74
|
+
"فولوي": "follow",
|
|
75
|
+
"أنفولوي": "unfollow",
|
|
76
|
+
"لايك": "like",
|
|
77
|
+
"ديسلايك": "dislike",
|
|
78
|
+
"بارطاجي": "share",
|
|
79
|
+
"كومونتير": "comment",
|
|
80
|
+
"بوست": "post",
|
|
81
|
+
"ستوري": "story",
|
|
82
|
+
"ريل": "reel",
|
|
83
|
+
"فيد": "feed",
|
|
84
|
+
"هاشتاغ": "hashtag",
|
|
85
|
+
"طاغي": "tag",
|
|
86
|
+
"مانسيوني": "mention",
|
|
87
|
+
"دي أم": "dm",
|
|
88
|
+
"إنبوكس": "inbox",
|
|
89
|
+
"نوتيفيكاسيون": "notification",
|
|
90
|
+
"نوتيف": "notification_plural",
|
|
91
|
+
"فيرال": "viral",
|
|
92
|
+
"توندونس": "trending",
|
|
93
|
+
"إكسبلور": "explore",
|
|
94
|
+
"ألغوريتم": "algorithm",
|
|
95
|
+
"سيلفي": "selfie",
|
|
96
|
+
"فيلتر": "filter",
|
|
97
|
+
"كابشن": "caption",
|
|
98
|
+
"لايف": "live",
|
|
99
|
+
"ستريم": "stream",
|
|
100
|
+
"سابسكرايب": "subscribe",
|
|
101
|
+
"سابس": "subscribers",
|
|
102
|
+
"فيو": "view",
|
|
103
|
+
"فيوز": "views",
|
|
104
|
+
"كليكي": "click",
|
|
105
|
+
"لين فالبيو": "link_in_bio",
|
|
106
|
+
"سلاي": "slay",
|
|
107
|
+
"فايب": "vibe",
|
|
108
|
+
"فايبس": "vibes",
|
|
109
|
+
"كرنج": "cringe",
|
|
110
|
+
"كرنجي": "cringe_person",
|
|
111
|
+
"فليكسي": "flex",
|
|
112
|
+
"فاير": "fire",
|
|
113
|
+
"ليت": "lit",
|
|
114
|
+
"ميت بالضحك": "dead",
|
|
115
|
+
"لول": "lol",
|
|
116
|
+
"لماو": "lmao",
|
|
117
|
+
"ضحك": "rofl",
|
|
118
|
+
"برو": "bruh",
|
|
119
|
+
"خوي": "bro",
|
|
120
|
+
"ختي": "sis",
|
|
121
|
+
"بيستي": "bestie",
|
|
122
|
+
"غوستينغ": "ghosting",
|
|
123
|
+
"توكسيك": "toxic",
|
|
124
|
+
"مود": "mood",
|
|
125
|
+
"مودي أوف": "low_battery_social",
|
|
126
|
+
"كذب": "cap",
|
|
127
|
+
"نو كاب - صح": "no_cap",
|
|
128
|
+
"بيت - واخا": "bet",
|
|
129
|
+
"فور ريل - بالصح": "fr",
|
|
130
|
+
"صح صح": "fr_fr",
|
|
131
|
+
"غوت - أسطورة": "goat",
|
|
132
|
+
"ريز - كاريزما": "rizz",
|
|
133
|
+
"ديلولو - تحلم": "delulu",
|
|
134
|
+
"بيزد": "based",
|
|
135
|
+
"دبليو - فوز": "w",
|
|
136
|
+
"إل - خسارة": "l",
|
|
137
|
+
"سوس - مشبوه": "sus",
|
|
138
|
+
"ييت - ارمي": "yeet",
|
|
139
|
+
"شيش": "sheesh",
|
|
140
|
+
"بيريود - نقطة": "period",
|
|
141
|
+
"يضرب - زين حت": "slaps",
|
|
142
|
+
"دريب - ستايل": "drip",
|
|
143
|
+
"فيت - لبسة": "fit",
|
|
144
|
+
"أستيتيك": "aesthetic",
|
|
145
|
+
"مين كاراكتير": "main_character",
|
|
146
|
+
"بوف": "pov",
|
|
147
|
+
"فور يو بيج": "fyp",
|
|
148
|
+
"سكيبيدي": "skibidi",
|
|
149
|
+
"سيغما": "sigma",
|
|
150
|
+
"أوهايو - غريب": "ohio",
|
|
151
|
+
"غيات": "gyatt",
|
|
152
|
+
"فانوم تاكس": "fanum_tax",
|
|
153
|
+
"شات": "chat",
|
|
154
|
+
"غروب": "group_chat",
|
|
155
|
+
"سبام": "spam",
|
|
156
|
+
"سكام": "scam",
|
|
157
|
+
"فايك": "fake",
|
|
158
|
+
"ريل - حقيقي": "real",
|
|
159
|
+
"ميد - عادي": "mid",
|
|
160
|
+
"لوكي": "lowkey",
|
|
161
|
+
"هايكي": "highkey",
|
|
162
|
+
"إلي يعرف يعرف": "iykyk",
|
|
163
|
+
"ما يهمني": "idc",
|
|
164
|
+
"ما نعرف": "idk",
|
|
165
|
+
"بصراحة": "tbh",
|
|
166
|
+
"ما نكذب عليك": "ngl",
|
|
167
|
+
"راجع": "brb",
|
|
168
|
+
"أفكا": "afk",
|
|
169
|
+
"فالواقع": "irl",
|
|
170
|
+
"دي أم مي": "dm_me",
|
|
171
|
+
"طيح اللين": "link_drop",
|
|
172
|
+
"راسيو": "ratio",
|
|
173
|
+
"كانسل": "canceled",
|
|
174
|
+
"بان": "banned",
|
|
175
|
+
"شادو بان": "shadowban",
|
|
176
|
+
"رجع": "unbanned",
|
|
177
|
+
"ميزاجور": "update",
|
|
178
|
+
"أبغريد": "upgrade",
|
|
179
|
+
"فيتشور": "feature",
|
|
180
|
+
"فيكس بغ": "bug_fix",
|
|
181
|
+
"حسانية - لغة الشباب و التقنية": "nativeName"
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"walou": "null_empty",
|
|
53
53
|
"fasa5": "clear_delete",
|
|
54
54
|
"nadhaf": "clear_delete",
|
|
55
|
-
"5edma": "
|
|
55
|
+
"5edma": "function",
|
|
56
56
|
"fonction": "function_method",
|
|
57
57
|
"cha8el": "run_execute",
|
|
58
58
|
"e5dem": "run_execute",
|
|
@@ -109,7 +109,88 @@
|
|
|
109
109
|
"s7i7_walla_la": "boolean",
|
|
110
110
|
"rattab": "sort",
|
|
111
111
|
"saffi": "filter",
|
|
112
|
-
"barcha": "many"
|
|
112
|
+
"barcha": "many",
|
|
113
|
+
"idhaa": "if",
|
|
114
|
+
"lkn": "if",
|
|
115
|
+
"itha": "if",
|
|
116
|
+
"edha": "if",
|
|
117
|
+
"louken": "if",
|
|
118
|
+
"idh": "if",
|
|
119
|
+
"ida": "if",
|
|
120
|
+
"eda": "if",
|
|
121
|
+
"idha ken": "if",
|
|
122
|
+
"kene": "if",
|
|
123
|
+
"snn": "else",
|
|
124
|
+
"wella": "else",
|
|
125
|
+
"wela": "else",
|
|
126
|
+
"wla": "else",
|
|
127
|
+
"mouch haka": "else",
|
|
128
|
+
"mch haka": "else",
|
|
129
|
+
"akeka le": "else",
|
|
130
|
+
"bsh": "for",
|
|
131
|
+
"7ata": "for",
|
|
132
|
+
"hata": "for",
|
|
133
|
+
"taw bech": "for",
|
|
134
|
+
"bch ta3mel": "for",
|
|
135
|
+
"3la 5ater": "for",
|
|
136
|
+
"toul": "while",
|
|
137
|
+
"leen": "while",
|
|
138
|
+
"7ata lin": "while",
|
|
139
|
+
"wa9teli": "while",
|
|
140
|
+
"wakteli": "while",
|
|
141
|
+
"tama ken": "while",
|
|
142
|
+
"fct": "function",
|
|
143
|
+
"fonct": "function",
|
|
144
|
+
"5dma": "function",
|
|
145
|
+
"khedmaa": "function",
|
|
146
|
+
"khedma": "function",
|
|
147
|
+
"rj3": "return",
|
|
148
|
+
"raj3": "return",
|
|
149
|
+
"rj3li": "return",
|
|
150
|
+
"raja3li": "return",
|
|
151
|
+
"9oss": "break",
|
|
152
|
+
"o9ef": "break",
|
|
153
|
+
"ogf": "break",
|
|
154
|
+
"ogef": "break",
|
|
155
|
+
"gos": "break",
|
|
156
|
+
"ougef": "break",
|
|
157
|
+
"e9f": "break",
|
|
158
|
+
"kammel": "continue",
|
|
159
|
+
"kamel": "continue",
|
|
160
|
+
"wasil": "continue",
|
|
161
|
+
"kaml": "continue",
|
|
162
|
+
"kml": "continue",
|
|
163
|
+
"sa7": "true",
|
|
164
|
+
"shih": "true",
|
|
165
|
+
"8alet": "false",
|
|
166
|
+
"8alt": "false",
|
|
167
|
+
"8lt": "false",
|
|
168
|
+
"mch s7i7": "false",
|
|
169
|
+
"fer8": "null",
|
|
170
|
+
"mfamach": "null",
|
|
171
|
+
"fr8": "null",
|
|
172
|
+
"mfmch": "null",
|
|
173
|
+
"7ott": "let",
|
|
174
|
+
"5alli": "let",
|
|
175
|
+
"ged": "let",
|
|
176
|
+
"7ot": "let",
|
|
177
|
+
"a3ml": "let",
|
|
178
|
+
"9oull": "print",
|
|
179
|
+
"9olo": "print",
|
|
180
|
+
"9ol": "print",
|
|
181
|
+
"a7ki": "print",
|
|
182
|
+
"9oulou": "print",
|
|
183
|
+
"golo": "print",
|
|
184
|
+
"goul": "print",
|
|
185
|
+
"golih": "print",
|
|
186
|
+
"zid": "push",
|
|
187
|
+
"zidli": "push",
|
|
188
|
+
"da5l": "push",
|
|
189
|
+
"da5al": "push",
|
|
190
|
+
"n7i": "pop",
|
|
191
|
+
"hezz": "pop",
|
|
192
|
+
"9adech": "length",
|
|
193
|
+
"9dchfih": "length"
|
|
113
194
|
},
|
|
114
195
|
"symbols": {}
|
|
115
|
-
}
|
|
196
|
+
}
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import path from "path"
|
|
|
2
2
|
import { fileURLToPath } from "url"
|
|
3
3
|
import fs from "fs"
|
|
4
4
|
import { dialects } from "./src/dialect-registry.js"
|
|
5
|
+
import { createRequire } from "module"
|
|
5
6
|
|
|
6
7
|
const __filename = fileURLToPath(import.meta.url)
|
|
7
8
|
const __dirname = path.dirname(__filename)
|
|
@@ -22,6 +23,13 @@ export function getAllDialects() {
|
|
|
22
23
|
return dialects.map(e => load(e))
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
const _transpile = createRequire(import.meta.url)("./bayda-transpile.cjs")
|
|
27
|
+
export function transpile(code, dialect = "kab") {
|
|
28
|
+
const entry = dialects.find(d => d.code === dialect)
|
|
29
|
+
if (!entry) throw new Error(`${dialect} not found`)
|
|
30
|
+
return _transpile(code, path.join(__dirname, "data/dialects", entry.file))
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
export { dialects }
|
|
26
34
|
|
|
27
35
|
export const kab = getDialect("kab")
|
|
@@ -31,10 +39,10 @@ export const dzLatn = getDialect("dz-latn")
|
|
|
31
39
|
export const tnLatn = getDialect("tn-latn")
|
|
32
40
|
export const ly = getDialect("ly")
|
|
33
41
|
export const ma = getDialect("mauritania")
|
|
34
|
-
export default { getDialect, getAllDialects, dialects, kab, dz, ly, ma, kabLatn, dzLatn, tnLatn }
|
|
42
|
+
export default { transpile, getDialect, getAllDialects, dialects, kab, dz, ly, ma, kabLatn, dzLatn, tnLatn }
|
|
35
43
|
|
|
36
44
|
const arg = process.argv[2] || "kab"
|
|
37
|
-
if (
|
|
45
|
+
if ((()=>{try{return fs.realpathSync(process.argv[1])===fs.realpathSync(__filename)}catch{return false}})()) {
|
|
38
46
|
if (arg === "--test") {
|
|
39
47
|
let bad = 0
|
|
40
48
|
for (const e of dialects) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bayda-maghreb",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Bayda Maghreb -
|
|
5
|
-
"type": "module",
|
|
3
|
+
"version": "1.1.6",
|
|
4
|
+
"description": "Bayda Maghreb - 7 dialects clean + Gen 2 Tech",
|
|
6
5
|
"main": "index.js",
|
|
7
|
-
"
|
|
8
|
-
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "vitest run",
|
|
8
|
+
"test:watch": "vitest",
|
|
9
|
+
"audit": "node audit.cjs"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/ajilisaifeddine-lab/bayda-maghreb.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"arabic",
|
|
17
|
+
"darija",
|
|
18
|
+
"kabyle",
|
|
19
|
+
"amazigh",
|
|
20
|
+
"maghreb"
|
|
21
|
+
],
|
|
9
22
|
"author": "ajilis",
|
|
10
|
-
"license": "MIT"
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/ajilisaifeddine-lab/bayda-maghreb/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/ajilisaifeddine-lab/bayda-maghreb#readme",
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "^7.0.2",
|
|
31
|
+
"vitest": "^5.0.4"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"index.js",
|
|
35
|
+
"src",
|
|
36
|
+
"lahjat",
|
|
37
|
+
"data",
|
|
38
|
+
"bayda-transpile.cjs"
|
|
39
|
+
]
|
|
11
40
|
}
|
package/.gitignor
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules/
|
package/core/ast.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Node={type:string;[k:string]:any}; export type Program={type:'Program';body:Node[]};
|
package/core/compile.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {parse} from './parser.js'; export function compile(src:string){return parse(src);}
|
package/core/lexer.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type TokenType = 'IDENT'|'NUMBER'|'STRING'|'KEYWORD'|'SYMBOL'|'NEWLINE'|'EOF';
|
|
2
|
-
export interface Token{type:TokenType;value:string;line:number;col:number;}
|
|
3
|
-
const KEYWORDS=new Set(['ila','awla','wila','hata','dir','safi','ktab','jib','khrej']);
|
|
4
|
-
export function lex(input:string):Token[]{const tokens:Token[]=[];let line=1,col=1,i=0;while(i<input.length){const c=input[i];if(c==='\n'){tokens.push({type:'NEWLINE',value:'\n',line,col});line++;col=1;i++;continue;}if(/\s/.test(c)){col++;i++;continue;}if(c==='"'||c==="'"){const q=c;let v='';i++;col++;while(i<input.length&&input[i]!==q){v+=input[i];i++;col++;}i++;col++;tokens.push({type:'STRING',value:v,line,col});continue;}if(/[0-9]/.test(c)){let v='';while(i<input.length&&/[0-9.]/.test(input[i])){v+=input[i];i++;col++;}tokens.push({type:'NUMBER',value:v,line,col});continue;}if(/[a-zA-Z_ء-يⴰ-⵿]/.test(c)){let v='';while(i<input.length&&/[a-zA-Z0-9_ء-يⴰ-⵿]/.test(input[i])){v+=input[i];i++;col++;}if(KEYWORDS.has(v))tokens.push({type:'KEYWORD',value:v,line,col});else tokens.push({type:'IDENT',value:v,line,col});continue;}tokens.push({type:'SYMBOL',value:c,line,col});i++;col++;}tokens.push({type:'EOF',value:'',line,col});return tokens;}
|
package/core/loader.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'; import path from 'path'; export function loadDialect(name:string){const p=path.join(process.cwd(),'data','dialects',`${name}.json`);if(fs.existsSync(p))return JSON.parse(fs.readFileSync(p,'utf-8'));return null;}
|
package/core/mapping.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const baseMapping:Record<string,string>={ila:'if',awla:'else',wila:'elif',hata:'while',dir:'do',safi:'end',ktab:'print',jib:'input',khrej:'return'};
|
package/core/normalizer.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {Token} from './lexer.js'; export function normalize(tokens:Token[]):Token[]{return tokens;}
|
package/core/parser.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {lex} from './lexer.js'; import {Program} from './ast.js'; export function parse(input:string):Program{const tokens=lex(input);const body:any[]=[];let i=0;while(i<tokens.length){const t=tokens[i];if(t.type==='EOF')break;if(t.type==='NEWLINE'){i++;continue;}if(t.type==='KEYWORD'&&t.value==='ktab'){i++;if(tokens[i]){body.push({type:'Print',value:tokens[i].value});i++;}continue;}i++;}return{type:'Program',body};}
|
package/core/schema.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {z} from 'zod'; export const DialectSchema=z.object({name:z.string(),keywords:z.record(z.string()),symbols:z.record(z.string())});
|
package/core/types.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export interface Dialect{name:string;keywords:Record<string,string>;symbols:Record<string,string>;}
|
package/data/dialects/kab.json
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"code": "kab",
|
|
3
|
-
"name": "Kabyle",
|
|
4
|
-
"keywords": {
|
|
5
|
-
"ila": "if",
|
|
6
|
-
"ma_yella": "if",
|
|
7
|
-
"awla": "else",
|
|
8
|
-
"ma_ulac": "else",
|
|
9
|
-
"asmi": "while",
|
|
10
|
-
"armi": "while",
|
|
11
|
-
"bedd": "break",
|
|
12
|
-
"kemmel": "continue",
|
|
13
|
-
"afecku": "function",
|
|
14
|
-
"tarrayt": "function",
|
|
15
|
-
"err_d": "return",
|
|
16
|
-
"rra_d": "return",
|
|
17
|
-
"tidet": "true",
|
|
18
|
-
"tikerkas": "false",
|
|
19
|
-
"ulac": "null",
|
|
20
|
-
"sider": "import",
|
|
21
|
-
"sufɣ": "export",
|
|
22
|
-
"taggayt": "class",
|
|
23
|
-
"amaynur": "new",
|
|
24
|
-
"asekfel": "try",
|
|
25
|
-
"ttef": "catch",
|
|
26
|
-
"taggara": "finally",
|
|
27
|
-
"ḍegger": "throw",
|
|
28
|
-
"afus": "Array",
|
|
29
|
-
"awalen": "String",
|
|
30
|
-
"umḍan": "Number",
|
|
31
|
-
"tamsirt": "Object",
|
|
32
|
-
"tabadut": "Boolean",
|
|
33
|
-
"asizdeg": "filter",
|
|
34
|
-
"asnifel": "map",
|
|
35
|
-
"agmer": "reduce",
|
|
36
|
-
"nadi": "find",
|
|
37
|
-
"arnu": "push",
|
|
38
|
-
"kkes": "pop",
|
|
39
|
-
"meslay": "console.log",
|
|
40
|
-
"seqdec": "sort",
|
|
41
|
-
"beddel": "replace",
|
|
42
|
-
"ferren": "split",
|
|
43
|
-
"seddukel": "join",
|
|
44
|
-
"semsawi": "equal",
|
|
45
|
-
"ameqqran": "greater",
|
|
46
|
-
"ameẓyan": "less",
|
|
47
|
-
"tikli": "loop",
|
|
48
|
-
"tikelt": "iteration",
|
|
49
|
-
"aɣbalu": "source",
|
|
50
|
-
"abrid": "path",
|
|
51
|
-
"isem": "name",
|
|
52
|
-
"azal": "value",
|
|
53
|
-
"tamawt": "type",
|
|
54
|
-
"asumer": "await",
|
|
55
|
-
"raǧu": "async",
|
|
56
|
-
"tazmert": "promise",
|
|
57
|
-
"tuccḍa": "error",
|
|
58
|
-
"tiɣri": "call",
|
|
59
|
-
"asali": "apply",
|
|
60
|
-
"tuqqna": "bind",
|
|
61
|
-
"akal": "global",
|
|
62
|
-
"agmam": "module",
|
|
63
|
-
"tawuri": "process",
|
|
64
|
-
"inadi": "index",
|
|
65
|
-
"amḍan": "count",
|
|
66
|
-
"amzwaru": "first",
|
|
67
|
-
"aneggaru": "last",
|
|
68
|
-
"talemmast": "middle",
|
|
69
|
-
"ini": "say",
|
|
70
|
-
"steqsi": "prompt",
|
|
71
|
-
"wali": "check",
|
|
72
|
-
"suɣel": "stringify"
|
|
73
|
-
}
|
|
74
|
-
}
|
package/examples/hello.kab
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ktab "azul"
|
package/examples/hello.ly
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ktab "azul"
|
package/expected/hello.kab.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
azul
|
package/expected/hello.ly.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
azul
|
package/hello.kab.bayda
DELETED
package/index.html
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ar" dir="rtl">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>بيضة مغرب - Bayda Maghreb</title>
|
|
7
|
-
<style>
|
|
8
|
-
body{font-family:system-ui; background:#0f0f0f; color:white; margin:0; padding:20px; text-align:center}
|
|
9
|
-
h1{font-size:3rem; margin:20px 0}
|
|
10
|
-
.card{background:#1a1a1a; padding:30px; border-radius:20px; max-width:600px; margin:30px auto; border:1px solid #333}
|
|
11
|
-
a{color:#4ade80; text-decoration:none; font-weight:bold}
|
|
12
|
-
.btn{background:#4ade80; color:black; padding:12px 25px; border-radius:30px; display:inline-block; margin:10px}
|
|
13
|
-
code{background:#222; padding:4px 8px; border-radius:6px; direction:ltr; display:inline-block}
|
|
14
|
-
</style>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<h1>🥚 بيضة مغرب</h1>
|
|
18
|
-
<p>لغة برمجة مغاربية - Bayda Maghreb Programming Language</p>
|
|
19
|
-
<div class="card">
|
|
20
|
-
<h2>المشروع حي! 🔥</h2>
|
|
21
|
-
<p>ABM هي لغة برمجة بالدارجة التونسية والمغاربية</p>
|
|
22
|
-
<p><code>دالة سلام() { ارجع "مرحبا بالعالم" }</code></p>
|
|
23
|
-
<br>
|
|
24
|
-
<a class="btn" href="https://github.com/ajilisaifeddine-lab/bayda-maghreb">شوف الكود على GitHub</a>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="card">
|
|
27
|
-
<h3>كيف تجربها؟</h3>
|
|
28
|
-
<p>git clone https://github.com/ajilisaifeddine-lab/bayda-maghreb.git</p>
|
|
29
|
-
<p>cd bayda-maghreb && npm install && npm start</p>
|
|
30
|
-
</div>
|
|
31
|
-
<p style="opacity:0.5; margin-top:50px">Made with ❤️ in Hammamet by ajilisaifeddine-lab</p>
|
|
32
|
-
</body>
|
|
33
|
-
</html>
|
package/run-kab.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { createRequire } from 'module'
|
|
3
|
-
const require = createRequire(import.meta.url)
|
|
4
|
-
const kab = require('./data/dialects/kabyle.json')
|
|
5
|
-
|
|
6
|
-
let file = process.argv[2]
|
|
7
|
-
if(!file){ console.log("Usage: node run-kab.js file.kab.bayda"); process.exit(1) }
|
|
8
|
-
|
|
9
|
-
let code = fs.readFileSync(file,'utf8')
|
|
10
|
-
let entries = Object.entries(kab.keywords).sort((a,b)=>b[0].length-a[0].length)
|
|
11
|
-
for(let [k,v] of entries){
|
|
12
|
-
let en = v==='log'?'console.log':v
|
|
13
|
-
code = code.replace(new RegExp("\\b"+k+"\\b","g"), en)
|
|
14
|
-
}
|
|
15
|
-
eval(code)
|
package/test.kab.bayda
DELETED
package/test.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { kab, getDialect, getAllDialects } from './index.js'
|
|
2
|
-
|
|
3
|
-
const kabData = getDialect('kab')
|
|
4
|
-
console.log('✅ kab:', kabData.name, '-', Object.keys(kabData.keywords).length, 'words')
|
|
5
|
-
|
|
6
|
-
const dzData = getDialect('dz')
|
|
7
|
-
console.log('✅ dz:', dzData.name, '-', Object.keys(dzData.keywords).length, 'words')
|
|
8
|
-
|
|
9
|
-
console.log('✅ كلهم:', getAllDialects().length, 'لهجات')
|
package/tests/core/lexer.test.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"outDir": "dist"
|
|
10
|
-
},
|
|
11
|
-
"include": ["core/**/*.ts","writers/**/*.ts","tests/**/*.ts"]
|
|
12
|
-
}
|
package/vitest.config.ts
DELETED
package/writers/python-writer.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function toPython(node:any):string{ if(node.type==="Program") return node.body.map(toPython).join("\n"); if(node.type==="Print") return `print("${node.value}")`; return ""; }
|
package//330/263/330/261
DELETED
|
File without changes
|