/eog

EO programs to Call Flow Graph (CFG) transformator

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

This is a command line tool that takes a directory with XMIR files (XML representation of EO programs) and produces a directory with .eog files, each of which is a textual representaiton of a Control Flow Graph (CFG) in EOG language (we invented it). Run it like this (download the latest version of the eog.jar JAR from here):

$ java -jar eog.jar --help

For example, this is an input EO program:

[n] > fibo
  if. > @
    n.lt 2
    1
    plus.
      fibo (n.minus 1)
      fibo (n.minus 2)

This is how a generated EOG program may look (this is a very early draft!):

@fibo(n):
  x1 := @if(n)
  Return x1

@if(n):
  x1 := Dataized @lt(n)
  Jump #A If x1
  x2 := @plus(n)
  Jump #B
  #A
  x2 := Int 1
  #B
  Return x2

@lt(n):
  x1 := Dataized n
  x2 := Int 2
  x3 := Math.Lt x1 x2
  Return x3

@plus(n):
  x1 := Dataized @fibo1(n)
  x2 := Dataized @fibo2(n)
  x3 := Math.Plus x1 x2
  Return x3

@fibo1(n):
  x1 := @minus1(n)
  x2 := @fibo(n=x1)
  Return x2

@minus1(n):
  x1 := Dataized n
  x2 := Int 1
  x3 := Math.Minus x1 x2
  Return x3

@fibo2(n):
  x1 := @minus1(n)
  x2 := @fibo(n=x1)
  Return x2

@minus2(n):
  x1 := Dataized n
  x2 := Int 2
  x3 := Math.Minus x1 x2
  Return x3

This is how it can be sequentialized:

@fibo(n):
  @if(n):
    @lt(n):
      x1.1.1 := Dataized n
      x1.1.2 := Int 2
      x1.1.3 := Math.Lt x1.1.1 x1.1.2
      x1.1 := Dataized x1.1.3
    Jump #A If x1.1
          x1.2.1.1.1 := Dataized n
          x1.2.1.1.2 := Int 1
          x1.2.1.1.3 := Math.Minus x1.2.1.1.1 x1.2.1.1.2
          x1.2.1.1 := x1.2.1.1.3
        x1.2.1.2 := @fibo(n=x1.2.1.1)
        x1.2.1 := Dataized x1.2.1.2
          x1.2.2.1.1 := Dataized n
          x1.2.2.1.2 := Int 2
          x1.2.2.1.3 := Math.Minus x1.2.2.1.1 x1.2.2.1.2
          x1.2.2.1 := x1.2.2.1.3
        x1.2.2.2 := @fibo(n=x1.2.2.1)
        x1.2.2 := Dataized x1.2.2.2
      x1.2.3 := Math.Plus x1.2.1 x1.2.2
      x1.2 := x1.2.3
    Jump #B
    #A
    x1.2 := Int 1
    #B
    x1 := x1.2
  Return x1

The EOG-script of the if atom may look like this:

@if(ρ, α0, α1):
  x1 := Dataized ρ
  Jump #A If x1
  x2 := α1
  Jump #B
  #A
  x2 := α0
  #B
  Return x2

There is also a Java API, which helps you read a file with EOG program and then access it in a graph-traversing mode.