xerox
f717a280f7
|
5 years ago | |
---|---|---|
assign | 5 years ago | |
examples | 5 years ago | |
functions | 5 years ago | |
hashmap | 5 years ago | |
linkedlist | 5 years ago | |
logic | 5 years ago | |
networking | 5 years ago | |
parser | 5 years ago | |
5 years ago | ||
vars | 5 years ago | |
README.md | 5 years ago | |
deon | 5 years ago | |
deon.l | 5 years ago | |
deon.y | 5 years ago | |
make.sh | 5 years ago |
README.md
Deon programming language V0.9.1 update notes
My computer programming language made with LEX/YACC written in C. (interpreted)
- Moved nodeInfo declarations to its own folder/file
- Moved print declarations to its own folder/file
- Moved heads of linked lists/hashmaps to headerfiles
Example Program.
Everything in this language is based around "Structs". These are not the regular structs that are in C. To make a hello world program it would look like this:
def Main : {
printf[ "hello world" ];
};
call Main;
Requirements to making a program:
1.) a struct.
2.) a call statement.
Variables
Variables are stored in a hashmap for quick and easy access. Variables also support type juggling. When you define a variable its type will be assumed when parsed. For example, all positive numbers will be treated like an unsigned long double.
myint = 121231; // double (unsigned long)
mydouble = -123.122; // double (signed double)
mystring = "cool string"; // string
mychar = 'c'; // char
myfunction = { printf[ "hello world" ]; }; (statement list)
Variables are scoped to the struct that they are defined in. This is so everything is not global. An example of this would look:
def MyDog : {
age = -153000;
name = "i dont have a name";
printfMyName = {
printf[ name ];
};
};
def Main : {
someOtherAge = 2;
myRealDogsName = "cat"; // because variable naming is the hardest thing in computer science.
printfMyName = {
printf[ someOtherAge ];
};
call MyDog::printfMyName;
/*
When you do not use the scope resolution modifier then it will only check local functions.
The local function hashmap is stored in the head of your functions linked list.
/*
call printfMyName
};
call Main;
Logic
Logic is first evaluated and if deemed valid then a list of statements will be executed.
if [ 10 > 9 ]: {
printf [ "10 is bigger than 9!" ];
newInt = 100;
};
if [ {int} newInt > 99 ]: {
printf [ "newInt is bigger than 99" ];
};
Functions
Functions can be declared inside of a struct and accessed by anyone who uses the scope resolution operator. Do not mistake structs as functions just because you can interact with them in the same way. Functions do not have "scope" like structs do. Functions can interact with all elements in the parenting struct including other functions, and those functions local variables.
def NewStruct : {
someFunction = {
printf[ "hello world" ];
};
};
call NewStruct;
Coming soon
TCP networking, file handling, and finally loops!