File tree Expand file tree Collapse file tree 6 files changed +40
-14
lines changed
Expand file tree Collapse file tree 6 files changed +40
-14
lines changed Original file line number Diff line number Diff line change 1717help = """
18180 <- start
19191 <- end
20- 2 <- print
21- 3 <- var
22- 4 <- Compare
20+ 2thing <- print
21+ 3name:value <- var
22+ 4number[=/!/</>] <- Compare
23+ 5 <- pass
2324% <- comment
24- ^ <- Math-Operation-Start
25+ ^number[+/-/\//]number <- Math-Operation-Start
26+ ?conditon:True:False <- If-Else
2527"""
2628
2729space = ""
3537 with open (args .file , "r" ) as file :
3638 code = file .read ()
3739 code = code .replace ("\n " , " " )
38- Interpreter .interpret (code )
40+ Interpreter .interpret (Interpreter , code )
3941else :
4042 print (f"""
4143 +------------------------------------------+
4244 | NumberScript Shell: Type 'exit' to exit. |
43- | Version: 1.6.1 Machine: { os .name } { space } |
45+ | Version: 1.7.0 Machine: { os .name } { space } |
4446 | Type 'help' for more information. |
4547 | { current_time } |
4648 +------------------------------------------+
Original file line number Diff line number Diff line change @@ -135,9 +135,14 @@ def interpret(self, code: str) -> str:
135135 re_code = code [j ].replace ("?" , "" , 1 )
136136 statements = re_code .split (":" )
137137 if Checker (statements [0 ], variables ):
138- self .interpret (Interpreter , statements [1 ])
138+ true_statements = statements [1 ].replace ("\n " , " " )
139+ self .interpret (Interpreter , true_statements )
139140 else :
140- self .interpret (Interpreter , statements [2 ])
141+ false_statements = statements [2 ].replace ("\n " , " " )
142+ self .interpret (Interpreter , false_statements )
141143
142144 if code [j ] in variables .keys ():
143- print (variables [code [j ]])
145+ print (variables [code [j ]])
146+
147+ if code [j ].startswith ("5" ):
148+ pass
Original file line number Diff line number Diff line change @@ -18,18 +18,19 @@ pip install NumberScript
1818- Comments
1919- Only 5 commands
2020- A shell and a runner
21- - No loops or If-else (Who needs 'em)
21+ - No loops (Who needs 'em)
2222
2323## Docs
2424
2525### commands
2626
2727```
28- commands: 0 | 1 | 2 | 3 | 4
28+ commands: 0 | 1 | 2 | 3 | 4 | 5
2929comments: %
3030arithmetic: ^
3131Compare: = | ! | < | >
3232operations: + | - | * | / |
33+ If-Else: ? :
3334```
3435
3536> NOTE: You can't have different arithmetic signs in a single ^
@@ -57,10 +58,21 @@ Addition
5758^a+b %NoSpacesPlease
58591
5960```
61+
62+ If else
63+ ```
64+ %Is-This-lucky
65+ 0
66+ 3lucky_num:9
67+ ?lucky_num=8:28-Is-The-Lucky-Num:28-Is-Not-Lucky
68+ ?lucky_num=9:29-Is-The-Lucky-Num:29-Is-Not-Lucky
69+ ?lucky_num=10:210-Is-The-Lucky-Num:210-Is-Not-Lucky
70+ 1
71+ ```
6072> So, since there aren't any spaces what can we use instead of them?
6173
6274You can use _ or -.
6375
6476## To-Do
6577
66- - [ ] If-Else
78+ - [ ] Add loops
Original file line number Diff line number Diff line change 1+ %Is-This-lucky
2+ 0
3+ 3lucky_num:9
4+ ?lucky_num=8:28-Is-The-Lucky-Num:28-Is-Not-Lucky
5+ ?lucky_num=9:29-Is-The-Lucky-Num:29-Is-Not-Lucky
6+ ?lucky_num=10:210-Is-The-Lucky-Num:210-Is-Not-Lucky
7+ 1
Original file line number Diff line number Diff line change @@ -33,4 +33,4 @@ example 4:
3333 0
3434 3a:1
3535 3b:1
36- ?a=b( 2hello) :2bye
36+ ?a=b: 2hello:2bye
Original file line number Diff line number Diff line change 55
66setuptools .setup (
77 name = "NumberScript" ,
8- version = "1.6.1 " ,
8+ version = "1.7.0 " ,
99 description = "possibly the world's most simplest and restricted language." ,
1010 author = "Sasen Perera" ,
1111 long_description = longest_description ,
You can’t perform that action at this time.
0 commit comments