Home

Awesome

interpret

Basic interpreter for EVAL language. (totally invented :))

USAGE

interpret < file

EVAL language

The language is executed line per line.

Loop

while(E) E end

Test

if(E) E end

Variable declaration + affectation

V = E

Function call

foo(E)

Comments

Starting by # eg: a = a+b # A comment

Grammar

E = expression F = function R = float o = operator V = variable

E --> if(E) E --> while(E) E --> end E --> (E) E --> F(E) E --> V=E E --> R E --> V E --> EoE

o --> [+ - / ^ * % > < <= >= == !=]{1} V --> [A-Za-z]+ F --> [A-Za-z]+ R --> [-+]{0,1}[0-9.]+

Operators
Operators priority

You can use the () for change the priority.

Predefined functions

print(E) ===> print the value of the expression abs(E) ===> calc the absolute value of the expression sqrt(E) ===> function sqrt cos(E) ===> function cos

EXAMPLES

You can read test.txt, it's a basic program written in EVAL. It print all prime numbers between 1 and 1000.

TODO