This is test of making a programming language in C with the least amount of help from google as possible. This will be small interpreted language.
NOTE: this is my first C code. I only used C++ (as the most SIMILAR language to C).
| OS | Status (tested) | Runs as should | notes |
|---|---|---|---|
| Windows | ✅ | Yes | |
| Linux | ✅ | Yes | |
| Android | ✅ | Yes | Termux needs to be used |
| FreeBSD | ✅ | - | Compiled, other than that, not tested yet |
| iOS | ❌ | - | iSH terminal or similar terminal needs to be used |
| Mac (Intel) | ✅ | Yes | |
| Mac (Apple silicone) | ❌ | - |
for version 1.0.0 I want to test as many OS and hardware as possible (eg. OpenBSD, NetBSD, Haiku OS, ReactOS, maybe some others? These are those that I aim for that aren't in the table above).
Any code that's not in release is not meant as stable version, the main branch is more so development. Please for any project use any version from release.
Note: currently there are no releases
To compile it run in the root of this repository command:
python3 ./scripts/compile.py
This automatically runs the language with params from ./scripts/CompileRunParams.txt (which is usually examples/ex[num].dio).
Dio is procedural, statically typed that's weakly typed programming language. Working directory is generated through "-file" input, if you input "-file example/ex2.dio", DIO uses ./examples/ as it's working directory.
The name Dio comes from ancient Greek philosopher Diogenes of Sinope and his bowl story. Essentially, Diogenes saw kid drinking water from river with his hands, so he threw away his bowl (one of two things he owned). It's called Dio because it's trying to be minimalistic language (not in line count, but with how much it can do).
DIO supports three file extensions:
Everything else should raise error.
This parametre tells dio which file to use.
If this parametre isn't technically needed, it'll open "REPL" mode, which isn't finished, so it doesn't fully works, please don't use it, it's not finished.
This is now only used for writing out some values for this software (like version etc.).
NOTE: booleans internally are used as integers/floats, meaning the constrains for valid bools are checked while creating the variable not while using it. You can make boolean equal non boolean values AFTER you initialize it.
Dio uses >> as the symbol for single-line comments. Comments end when lexer either find ending of the line or the file ends.
Dio uses construction of >* (start) and *< (end) as multi-line comment. These comments end either when the file ends or when it finds the end symbol.
Note: if you only ues
>*everything afterwards will be taken af part of the comment.
>>Declaration
int a = 10;
>>use
int b = a + 1;
>>arrays
int arr = {1,2,3.5,7}
All normal booleans (true, false) are here, represented by either the word "true" or "false" (this is changed in lexer to 1 and 0 respectively). Dio also has special boolean, maybe, which is either 1 or 0 (determined in the parser).
def name()::void
>>code
end
def withParams(type : name, type2 : name2 ...)::void
>>they can have any amount of inputs
end
>>call
name()
withParams(a, 10) >> example, use variable and 10
>>NOTE: var types are now not fully used, so function can be parsed any argument
Functions can be declared without the "::void" but they can't return anything
>>Showing params and how chain functions
def a()::int
return 7
end
def b(int : a)::void
out(a)
end
def c(int : a)::int
return a + 1
end
int retVal = a():c()
b(retVal)
>>Writes out 7, because chain functions pair together so "a" returns 7 which then "c" adds 1 making it 8
Note: functions used in chain can't have more than one input for now, this will feature will be added
int i = 0;
while(i < 10)
i = i + 1
out(i)
end
>>outputs 1 -> 10
for (int i = 0; i < 10; i = i + 1)
out(i)
end
>>outputs 0 -> 9
NOTE: walrus operators are not implemented, you have to use "n = n ..."
if (condition)
>>code
elseif (condition)
>>code
else
>>code
end
>>this is without any condition
::gotoName::
>>code
goto ::gotoName::
>> goto with condition
::gotoName::
>>code
goto (condition) ::gotoName::
NOTE: if you don't use condition, it will run always
int a = 5
out(a)
Out is print function that prints out the variables or what you put into it.
Middle processor is kind of middle ware used to add code or change how lexing works. This is imitating (in a way*) pre-processor from C (or that's the idea behind itq*). All mid processor calls are prefixed with '#'.
#def *name*: *valid dio code* this makes macro which can be used with command #use *name#WIN *valid dio code* will make this piece of code run only and only on windows#LINUX *valid dio code* will make this piece of code run only and only on linux#MAC *valid dio code* will make this piece of code run only and only on mac OS#FREEBSD *valid dio code* will make this piece of code run only and only on freeBSD#ANDROID *valid dio code* will make this piece of code run only and only on AndroidNote: although OS like Android are supported, it's not yet possible to make code specific for android
C
91.6%
Python
8.4%
This is test of making a programming language in C with the least amount of help from google as possible. This will be small interpreted language.
NOTE: this is my first C code. I only used C++ (as the most SIMILAR language to C).
| OS | Status (tested) | Runs as should | notes |
|---|---|---|---|
| Windows | ✅ | Yes | |
| Linux | ✅ | Yes | |
| Android | ✅ | Yes | Termux needs to be used |
| FreeBSD | ✅ | - | Compiled, other than that, not tested yet |
| iOS | ❌ | - | iSH terminal or similar terminal needs to be used |
| Mac (Intel) | ✅ | Yes | |
| Mac (Apple silicone) | ❌ | - |
for version 1.0.0 I want to test as many OS and hardware as possible (eg. OpenBSD, NetBSD, Haiku OS, ReactOS, maybe some others? These are those that I aim for that aren't in the table above).
Any code that's not in release is not meant as stable version, the main branch is more so development. Please for any project use any version from release.
Note: currently there are no releases
To compile it run in the root of this repository command:
python3 ./scripts/compile.py
This automatically runs the language with params from ./scripts/CompileRunParams.txt (which is usually examples/ex[num].dio).
Dio is procedural, statically typed that's weakly typed programming language. Working directory is generated through "-file" input, if you input "-file example/ex2.dio", DIO uses ./examples/ as it's working directory.
The name Dio comes from ancient Greek philosopher Diogenes of Sinope and his bowl story. Essentially, Diogenes saw kid drinking water from river with his hands, so he threw away his bowl (one of two things he owned). It's called Dio because it's trying to be minimalistic language (not in line count, but with how much it can do).
DIO supports three file extensions:
Everything else should raise error.
This parametre tells dio which file to use.
If this parametre isn't technically needed, it'll open "REPL" mode, which isn't finished, so it doesn't fully works, please don't use it, it's not finished.
This is now only used for writing out some values for this software (like version etc.).
NOTE: booleans internally are used as integers/floats, meaning the constrains for valid bools are checked while creating the variable not while using it. You can make boolean equal non boolean values AFTER you initialize it.
Dio uses >> as the symbol for single-line comments. Comments end when lexer either find ending of the line or the file ends.
Dio uses construction of >* (start) and *< (end) as multi-line comment. These comments end either when the file ends or when it finds the end symbol.
Note: if you only ues
>*everything afterwards will be taken af part of the comment.
>>Declaration
int a = 10;
>>use
int b = a + 1;
>>arrays
int arr = {1,2,3.5,7}
All normal booleans (true, false) are here, represented by either the word "true" or "false" (this is changed in lexer to 1 and 0 respectively). Dio also has special boolean, maybe, which is either 1 or 0 (determined in the parser).
def name()::void
>>code
end
def withParams(type : name, type2 : name2 ...)::void
>>they can have any amount of inputs
end
>>call
name()
withParams(a, 10) >> example, use variable and 10
>>NOTE: var types are now not fully used, so function can be parsed any argument
Functions can be declared without the "::void" but they can't return anything
>>Showing params and how chain functions
def a()::int
return 7
end
def b(int : a)::void
out(a)
end
def c(int : a)::int
return a + 1
end
int retVal = a():c()
b(retVal)
>>Writes out 7, because chain functions pair together so "a" returns 7 which then "c" adds 1 making it 8
Note: functions used in chain can't have more than one input for now, this will feature will be added
int i = 0;
while(i < 10)
i = i + 1
out(i)
end
>>outputs 1 -> 10
for (int i = 0; i < 10; i = i + 1)
out(i)
end
>>outputs 0 -> 9
NOTE: walrus operators are not implemented, you have to use "n = n ..."
if (condition)
>>code
elseif (condition)
>>code
else
>>code
end
>>this is without any condition
::gotoName::
>>code
goto ::gotoName::
>> goto with condition
::gotoName::
>>code
goto (condition) ::gotoName::
NOTE: if you don't use condition, it will run always
int a = 5
out(a)
Out is print function that prints out the variables or what you put into it.
Middle processor is kind of middle ware used to add code or change how lexing works. This is imitating (in a way*) pre-processor from C (or that's the idea behind itq*). All mid processor calls are prefixed with '#'.
#def *name*: *valid dio code* this makes macro which can be used with command #use *name#WIN *valid dio code* will make this piece of code run only and only on windows#LINUX *valid dio code* will make this piece of code run only and only on linux#MAC *valid dio code* will make this piece of code run only and only on mac OS#FREEBSD *valid dio code* will make this piece of code run only and only on freeBSD#ANDROID *valid dio code* will make this piece of code run only and only on AndroidNote: although OS like Android are supported, it's not yet possible to make code specific for android
C
91.6%
Python
8.4%