Skip to content

Commit 9f6c5bf

Browse files
committed
more testcases, handled undefined var, recursive _interpretToken function, switch instead of if else, returns stack and output now, zero dependency on browser or framework
1 parent 0a10228 commit 9f6c5bf

33 files changed

+922
-1275
lines changed

src/exampleCodes/bintodec.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const tW = (strings) => {
2+
return strings
3+
.map((s) => s.replace(/\s+/g, "\n"))
4+
.join("")
5+
.trim();
6+
};
7+
8+
export const bintodec = tW`
9+
Binary=1111
10+
11+
DecimalValue=0
12+
13+
length=Binary.संख्या()
14+
15+
दुहराओ x को Binary मे
16+
17+
{
18+
19+
length=length-1
20+
21+
BinaryCharacter=Binary[x]
22+
23+
value=BinaryCharacter*2**length
24+
25+
DecimalValue=DecimalValue+value
26+
27+
}
28+
29+
दिखाए(DecimalValue)
30+
31+
32+
33+
34+
`;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const tW = (strings) => {
2+
return strings
3+
.map((s) => s.replace(/\s+/g, "\n"))
4+
.join("")
5+
.trim();
6+
};
7+
8+
export const undefined1 = tW`
9+
a=10
10+
11+
c=a+b
12+
13+
दिखाए(c)
14+
15+
16+
17+
`;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const tW = (strings) => {
2+
return strings
3+
.map((s) => s.replace(/\s+/g, "\n"))
4+
.join("")
5+
.trim();
6+
};
7+
8+
export const undefined2 = tW`
9+
10+
a=10
11+
12+
13+
c=b
14+
15+
दिखाए(c)
16+
17+
18+
19+
20+
21+
`;

src/exampleCodes/factorialof.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const tW = (strings) => {
2+
return strings
3+
.map((s) => s.replace(/\s+/g, "\n"))
4+
.join("")
5+
.trim();
6+
};
7+
8+
export const factorialOf = tW`
9+
factorialOf=5
10+
f=1
11+
count=1
12+
13+
अगर(factorialOf == 0 || factorialOf < 0){
14+
दिखाए("Invalid Input")
15+
}
16+
17+
जबतक(count < factorialOf+1){
18+
f=f*count
19+
count=count+1
20+
}
21+
22+
दिखाए("Factorial of" + factorialOf + " is " + f)
23+
24+
25+
26+
`;

src/exampleCodes/formname.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const tW = (strings) => {
2+
return strings
3+
.map((s) => s.replace(/\s+/g, "\n"))
4+
.join("")
5+
.trim();
6+
};
7+
8+
export const formname = tW`
9+
नाम='test'
10+
11+
नतीजा=""
12+
13+
दुहराओ x को नाम मे
14+
15+
{
16+
17+
अक्षर=नाम[x]
18+
19+
नतीजा=नतीजा+अक्षर
20+
21+
दिखाए(नतीजा)
22+
23+
24+
}
25+
26+
27+
`;

src/exampleCodes/function2.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const tW = (strings) => {
2+
return strings
3+
.map((s) => s.replace(/\s+/g, "\n"))
4+
.join("")
5+
.trim();
6+
};
7+
8+
export const function2 = tW`
9+
रचना printname(count)
10+
{
11+
12+
जबतक(count<20)
13+
14+
{
15+
16+
count=count+1
17+
18+
दिखाए(count)
19+
20+
}
21+
22+
23+
}
24+
25+
26+
27+
28+
printname(10)
29+
30+
31+
32+
`;

0 commit comments

Comments
 (0)