EVA is a minimalist, Lisp-inspired, s-expressive, interpreted object-oriented programming language that supports dynamic binding, arithmetic operations, conditional statements, and more.
- Lisp-inspired syntax with S-expressions.
- Dynamic variable binding with
var. - Support for defining and calling functions with
lambdaanddef. - Basic arithmetic operations:
+,-,*,/. - Control flow with
if,while,for,switch. - Class and Object-Oriented programming with
class,new,prop. - Module system with
moduleandimport.
- Clone the EVA repository.
- Navigate to the project directory and run the following command to install dependencies:
npm install
You can run EVA from the command line with the following syntax:
eva -e "(expression)"This example calculates the square of 2 using a lambda function:
eva -e "(print ((lambda (x) (* x x)) 2))"This example creates a variable x with the value 10 and prints it:
eva -e "(var x 10) (print x)"This example defines two variables x and y, performs an arithmetic operation, and prints the result:
eva -e "(var x 10)(var y 20)(print (+ (* x y) 30))"This example uses an if expression to check if x is greater than 5 and prints the appropriate result:
eva -e "(var x 10) (print (if (> x 5) \"Greater than 5\" \"Less than or equal to 5\"))"This example uses a for loop to print the numbers from 1 to 5:
eva -e "(for (var x 1) (< x 6) (set x (+ x 1)) (print x))"To evaluate a script from a file, use the -f flag followed by the file path:
eva -f "path/to/your/file.eva"