You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xerox
c1c395ed78
|
5 years ago | |
---|---|---|
eon-unix | 5 years ago | |
eon-win | 5 years ago | |
LICENSE | 5 years ago | |
README.md | 5 years ago |
README.md
Eon programming language V0.9.6
My computer programming language made with LEX/YACC written in C. (interpreted)
Downloads
Supports both linux and windows, download link for current build can be found here: download link
Hello World.
Hello world in Eon.
def main:
{
print["hello world"];
};
call main;
Variables
- Variables support "type juggling" where types are assumed at runtime.
- Variables can be assigned to each other even if they are different types.
/* main function */
def main:
{
my_var = 121231; /* int */
print[my_var];
my_var = -123.122; /* double */
print[my_var];
my_var = "cool string"; /* null terminating string */
print[my_var];
my_var = 'c'; /* char */
print[my_var];
my_var = { print[ "hello world" ]; }; /* lambda function */
call my_var;
};
call main;
Expressions
- As ov v0.9.5 expressions are only supported for int types, I need to recode the entire expression parsing system to support up to doubles.
def main:
{
var = 10 + (5 * 2 / (11 % 2));
/* should print 20 */
print[var];
};
call main;
Scope
- As of v0.9.5 there is not scope inside of this programming language.
/* changes var from 10 to 100 */
def another_function:
{
var = 100;
};
def main:
{
var = 10;
/* should print 10 */
print[var];
call another_function;
/* should print 100 */
print[var];
};
call main;
Logic
- As of version 0.9.5, logic conditions must only be variables.
If statements
def main:
{
var = 1;
if[var]: /* condition must be a variable */
{
print["var was 1"];
var = 0;
};
if[var]:
{
print["this wont print! (or shouldnt)"];
};
};
call main;
While loops
def main:
{
var = 1;
/* loop that runs forever */
while[var]:
{
print["this will run forever"];
print["it also wont stack overflow, so dont worry"];
};
};
call main;
Functions
- Functions can be defined as variables (lambda) or defined normally.
def my_function:
{
some_function = {
print["hello world"];
};
call some_function;
};
call my_function;
Redefinitions
- As of v0.9.5 everything in this programming language can be redefined. That means everything, including the function that is currently being executed.
def main:
{
main = {
print["i just redefined main"];
};
};
call main;
call main;