Examples using Eia

Some fascinating/cool stuff. 💪 (The best are ordered first)

To try out all the examples yourself, just clone the repository:

git clone https://github.com/XomaDev/Eia64
cd Eia64

Eia requires a minimum version of Java 11 to run.

Trash Guy Animation

java -jar Eia64.jar examples/animation.eia

View source code (opens in a new tab). He asks you for a text:

HeAsks

But don't be kind! If you give it to him, he will steal it! 😭

HeStealsIt

Math solver

What about a simple math interpreter written in an interpreted language Eia which is written in JVM language Kotlin which is powered by C++? 🥰

Layers

Eia64 is written in Kotlin, which is a JVM Language. JVM Languages don't convert source code directly into machine code, they produce custom Bytecode instructions that are then executed by the Java Virtual Machine. JVM is implemented in C++.

Right now, the math interpreter can perform basic arithmetic operations (+ - / *) with operators * and / having higher priority.

java -jar Eia64.jar examples/mathsolver.eia

MathInterpreter

Note that the math interpreter doesn't utilize Float type, so doing floating point division or multiplication will round of the result.

Fib function

java -jar Eia64.jar examples/superfib.eia

View the source file. (opens in a new tab)
It is a good way to benchmark things. 👀

private fn fib(n: Int): Int =
    if (n < 2) n
    else fib(n - 1) + fib(n - 2)
 
fn main() {
  let startTime = time()
 
  println(
      "Result: " + fib(30),
      format(" took %d ms", time() - startTime)
  )
}
Result: 832040 took 442 ms
Took 482787497 ns

Cold start takes around ~488 millis to compute the fib() function on my PC.

Rock Paper Scissor

View source code. (opens in a new tab)
A simple Rock-Paper-Scissor game that you play with robot until one wins.

RockPaperScissor