Update README.md

master
xerox 5 years ago
parent c9835bda97
commit 2154b055e9

@ -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)
# Downloads
@ -8,11 +8,10 @@ Supports both linux and windows, download link for current build can be found he
Hello world in Eon.
```c
def main:
__main:
{
print["hello world"];
};
call main;
```
# Variables
@ -52,35 +51,24 @@ call main;
```
# 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
/* changes var from 10 to 100 */
def another_function:
{
var = 100;
def test[a]: {
if[a]: { print[a]; };
};
def main:
{
var = 10;
/* should print 10 */
print[var];
call another_function;
/* should print 100 */
print[var];
};
call main;
__main: { var = 10; print[var]; call test[var]; };
```
# 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
```c
def main:
__main:
{
var = 1;
if[var]: /* condition must be a variable */
@ -90,10 +78,9 @@ def main:
};
if[var]:
{
print["this wont print! (or shouldnt)"];
print["this wont print!"];
};
};
call main;
```
### While loops
@ -114,31 +101,32 @@ call main;
# Functions
* Functions can be defined as variables (lambda) or defined normally.
* Functions support parameters of any amount.
```c
def my_function:
def my_function[a, b, c, d]:
{
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.
```c
def main:
if[a]:
{
main = {
print["i just redefined main"];
if[b]:
{
print[c];
print[d];
};
};
call main;
call main;
};
__main:
{
var = 1;
test_string = "hello world";
call my_function[var, var, test_string, test_string];
};
```

Loading…
Cancel
Save