SimpleScript is a basic command language that supports saving and accessing of variables, conditional statements and loops.
Python version 3 will be required to run
On your command line enter
python main.py
- Ability to save and load a variable
- The variable can take mathematical expressions as a value, which will be evaluated first
- Error logs and tracebacks pointing out the location at which the error was caused
To save a variable
SAVE
To access a variable
SHOW
SAVE A 10
10
SHOW A
10
SAVE A 10*(10+5)
150
SAVE B 10^2
100
SAVE C 2 == 2 AND 4 == 5
0
SAVE D 2 == 2 AND 5 == 5
1
SAVE E IF 2==5 THEN 2 ELIF 3==5 THEN 3 ELSE 5
5
SAVE F 10+5
15
SAVE G F + 5
20
SHOW A
150
SHOW B
100
SHOW C
0
SHOW D
1
SHOW E
5
SHOW F
15
SHOW G
20
SAVE A 1
1
FOR i=1 TO 6 THEN SAVE A A*i
SHOW A
120
SAVE A 1
1
FOR i=5 TO 0 STEP -1 THEN SAVE A A*i
SHOW A
120
SAVE A 1
1
WHILE A < 50 THEN SAVE A A+1
SHOW A
50
SAVEA 10
Invalid Syntax: Expected Keyword, '+', '-' or '('
File <stdin>, line 1
SAVEA 10
^^^^^^^^
SAVE A
Invalid Syntax: Expected Keyword, '+', '-' or '('
File <stdin>, line 1
SAVE A
^
SHOW C
Traceback (most recent call last):
File <stdin>, line 1, in <simplescript>
Runtime Error: 'c' is not defined
SHOW C