excela

From Esolang
Jump to navigation Jump to search

excela represents a paradigm of relative programming. Everything in excela is variable. Surprisingly, it's Turing-complete. Because excela is a complex language, versions are complex numbers.

The name "excela" has its origin in "Microsoft Excel", which the language resembles. It shares the file suffixes .xls and .doc, too.

Grammar

A program consists of a set of Ruby assignments. Internally excela repeatedly performs all the assignments in an unspecified order, as long as something is changing.

Uses

  • Distributed algorithms.
  • Obfuscation for describing GUIs; excela is an ideal language for this.
  • Solving equations by iterative methods.

Hello world

In a normal language:

puts "Hello world"

In excela:

#helloworld.doc
i=126207244316550804821666916
j=10
#helloworld.xls
Output[Output[j] ? 1000 : j],i=i%256,i/(Output[j] ? 1 : 256)
j= j+((Output[j] && i!=0) ? -1 : 0)

Not so esoteric

The language excela is still not too obfuscated. Proof of this is this excela interpreter in excela:

#excela.doc
value=eval(IO.read(ARGV[1])) 
rulez=IO.read(ARGV[0]).split("\n")
c={}
#excela.xls
chg= rulez.inject(nil){|r,w| r||(c[v]!=(c[v]=eval(v))) } ? chg : !chg

And in Ruby:

#this version -3+6i is public domain
#!/usr/bin/ruby
include Math #to sin without math
        class Inputer #class which reads input
def initialize() @ar=[] end	
def [](a) (@ar<<STDIN.getc while a>=@ar.size ); @ar[a] end #define operator
	end			#end class
	class Outputer  #class which writes output
def initialize() @ar=[] @op=0	end	#end def
def [](a) @ar[a] end	#end def
def []=(a,v) raise "CRITICAL ERROR trying to ReWrItE oUtPuT" if  a<@op
@ar[a]=v;((STDOUT.putc @ar[@op];@op+=1)while @ar[@op]) end	
	end			#end class
value=eval(IO.read(ARGV[1])) # get value of file in $
Ring=binding #one ring to bind them all 
Rulez=IO.read(ARGV[0]).split("\n") #excela rulez
Input=Inputer.new ; Output=Outputer.new ;change=0
	while change    #we are applying rules while we are changing anything
change=false  #we didnt change anything yet
		Rulez.each(){|r|#we didnt change anything yet when we are trying to apply rule r
	begin raise "CRUCIAL ERROR -not assigned" if !(/(.*[^!=<>])=[^=]/===r)
rb=eval("["+$1+"]",Ring) ; eval(r,Ring) ; change||=(eval("["+$1+"]",Ring)!=rb) #and here we perhaps noticed that we changed something	 	 
	rescue puts "something bad with #{r}" #syntax or other error
		end } end

External resources