D Sharp is an interpreted programming language with the these math operations:
() ^ * / + -
Here is an example scriptexample script:
a = 1 + 2 + 3;
b = 1 * 2 * 3;
print(a);
print(b);
c = a * b;
print(c);
Here is another one:
hello = 6 + 4; y = 7 * 9;
print(hello + y);
print(y);
In order to run this script, it goes through three stages: tokenization, parsing, and interpretation.
tokenizer:
a = 1 + 2 + 3 -> [VARIABLE(a), EQUALS, NUMBER(1), PLUS, NUMBER(2), PLUS, NUMBER(3)]
parser:
[VARIABLE(a), EQUALS, NUMBER(1), PLUS, NUMBER(2), PLUS, NUMBER(3)]
->
PROGRAM
ASSIGNMENT
VARIABLE(a)
EXPRESSION
OPERATION(PLUS)
OPERATION(PLUS)
NUMBER(1)
NUMBER(2)
NUMBER(3)
interpreter:
sets a to { 1 + 2 + 3 }
evaluates { 1 + 2 + 3 } to 6
The source is accessible here