Advertisemen
Oni Compiler is my attempt for creating a compiler to compile a terrible language of my own devising. Currently Oni is just a codename, may turn into the real name of the final compiler, may not. It is written in C# due to that being what I'm most familiar with as of late.
The Oni language incorporates lambda expressions such as in Lambda Calculus or C#'s Lambda Expressions.
Anonymous functions:
Anonymous functions:
mso 9]>
As you can see from the above example, the Oni language is
A) over-complicated, and
B) uses post-fix arithmetic.
Named functions:
PRINT "Hello World
Add User Input
z<-(((INT,INT)(x,y)->(x x * y y * +)),3,5)
In C:
In C: z = 3*3 + 5*5
As you can see from the above example, the Oni language is
A) over-complicated, and
B) uses post-fix arithmetic.
Named functions:
(((INT,INT)(x,y)->(x*x+y*y)), SQUARESUM returns INT) z<-SQUARESUM(3,5)
In C:
int SQUARESUM(int x, int y) { return x*x+y*y; }
Example Programs:
Hello World
Hello World
PRINT "Hello World
Add User Input
INT X
INT Y
X<-READ
Y<-READ
PRINT (((INT,INT)(a,b)->(a b +)),X,Y)
The above examples of Oni are only a draft, I want to use the creation of the Oni language as a trigger for my to learn a functional language, Haskall or LISP (preferably both).
Advertisemen
Tidak ada komentar:
Posting Komentar