|
|
@ -1,4 +1,4 @@
|
|
|
|
# Eon programming language V0.9.6
|
|
|
|
# Eon programming language V0.9.6.1
|
|
|
|
My computer programming language made with LEX/YACC written in C. (interpreted)
|
|
|
|
My computer programming language made with LEX/YACC written in C. (interpreted)
|
|
|
|
|
|
|
|
|
|
|
|
# Downloads
|
|
|
|
# Downloads
|
|
|
@ -8,11 +8,10 @@ Supports both linux and windows, download link for current build can be found he
|
|
|
|
Hello world in Eon.
|
|
|
|
Hello world in Eon.
|
|
|
|
|
|
|
|
|
|
|
|
```c
|
|
|
|
```c
|
|
|
|
def main:
|
|
|
|
__main:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
print["hello world"];
|
|
|
|
print["hello world"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
call main;
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
# Variables
|
|
|
|
# Variables
|
|
|
@ -52,35 +51,24 @@ call main;
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
# Scope
|
|
|
|
# Scope
|
|
|
|
* As of v0.9.5 there is not scope inside of this programming language.
|
|
|
|
* As of v0.9.6.1 there is scope, but the scope is limited to functions. Anything inside of a function is accessable anywhere inside of that function.
|
|
|
|
|
|
|
|
|
|
|
|
```c
|
|
|
|
```c
|
|
|
|
/* changes var from 10 to 100 */
|
|
|
|
def test[a]: {
|
|
|
|
def another_function:
|
|
|
|
if[a]: { print[a]; };
|
|
|
|
{
|
|
|
|
|
|
|
|
var = 100;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
def main:
|
|
|
|
__main: { var = 10; print[var]; call test[var]; };
|
|
|
|
{
|
|
|
|
|
|
|
|
var = 10;
|
|
|
|
|
|
|
|
/* should print 10 */
|
|
|
|
|
|
|
|
print[var];
|
|
|
|
|
|
|
|
call another_function;
|
|
|
|
|
|
|
|
/* should print 100 */
|
|
|
|
|
|
|
|
print[var];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
call main;
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
# Logic
|
|
|
|
# Logic
|
|
|
|
|
|
|
|
|
|
|
|
* As of version 0.9.5, logic conditions must only be variables.
|
|
|
|
* As of version 0.9.5, logical conditions will evaluate the provided variable.
|
|
|
|
|
|
|
|
|
|
|
|
### If statements
|
|
|
|
### If statements
|
|
|
|
|
|
|
|
|
|
|
|
```c
|
|
|
|
```c
|
|
|
|
def main:
|
|
|
|
__main:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var = 1;
|
|
|
|
var = 1;
|
|
|
|
if[var]: /* condition must be a variable */
|
|
|
|
if[var]: /* condition must be a variable */
|
|
|
@ -90,10 +78,9 @@ def main:
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if[var]:
|
|
|
|
if[var]:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
print["this wont print! (or shouldnt)"];
|
|
|
|
print["this wont print!"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
call main;
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### While loops
|
|
|
|
### While loops
|
|
|
@ -114,31 +101,32 @@ call main;
|
|
|
|
|
|
|
|
|
|
|
|
# Functions
|
|
|
|
# Functions
|
|
|
|
* Functions can be defined as variables (lambda) or defined normally.
|
|
|
|
* Functions can be defined as variables (lambda) or defined normally.
|
|
|
|
|
|
|
|
* Functions support parameters of any amount.
|
|
|
|
```c
|
|
|
|
```c
|
|
|
|
def my_function:
|
|
|
|
def my_function[a, b, c, d]:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
some_function = {
|
|
|
|
some_function = {
|
|
|
|
print["hello world"];
|
|
|
|
print["hello world"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
call some_function;
|
|
|
|
call some_function;
|
|
|
|
};
|
|
|
|
|
|
|
|
call my_function;
|
|
|
|
if[a]:
|
|
|
|
```
|
|
|
|
{
|
|
|
|
|
|
|
|
if[b]:
|
|
|
|
# Redefinitions
|
|
|
|
{
|
|
|
|
* As of v0.9.5 everything in this programming language can be redefined. That means everything, including the function that
|
|
|
|
print[c];
|
|
|
|
is currently being executed.
|
|
|
|
print[d];
|
|
|
|
|
|
|
|
};
|
|
|
|
```c
|
|
|
|
|
|
|
|
def main:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
main = {
|
|
|
|
|
|
|
|
print["i just redefined main"];
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
call main;
|
|
|
|
__main:
|
|
|
|
call main;
|
|
|
|
{
|
|
|
|
|
|
|
|
var = 1;
|
|
|
|
|
|
|
|
test_string = "hello world";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call my_function[var, var, test_string, test_string];
|
|
|
|
|
|
|
|
};
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|