This is a programming language written from scratch by John Oseni, this is MIT licensed, feel free to contribute, Just started writting it
MIT License
./diamond.sh <diamondfilename>
What to write to run the codes:
python execute.py <diamondfilename>
diamond <diamondfilename>
You could check out my Schemacodes.diamond
in folder DIR
You can run it by running the following command in your terminal:
python execute.py Schemacodes.diamond
or by using the above: Windows, Mac or Linux.
The basic syntax for a diamond programming language program is: name of function any arguments to be passed in to the function
.
For example,
if you input spill Hello, World!
, spill
is the function in diamond
and Hello, World!
is the argument passed to it. To create a comment, use the # sign.
For example: # Of cause we know that this is a comment and it would be ignored by diamond PL
.
The current functions for diamond are:
Task: Print this in the console Arguments will be like :
hello world
)Sample: spill Hello, World!
Create a variable in diamond
Example: create_variable dior "this is me"
Description: Creates a function Arguments:
Example:
create_function my_world:
spill "hello"
when you wanna execute a function?:
# Type the function's name down
my_world
Task: Import another file into your own file Arguments:
Example: import hiworld
In hiworld.diamond, there is a function called my_function
. To run it, just type it in.
import hiworld
my_function
The import
function will always import everything in the file for now
Task: Runs a line of Python code in the diamond environment. Arguments:
Sample : python_run "print('Hello World!')"
This makes it go in line with python programming language, because it was written in python
For other samples check the folder Schemacodes.diamond
file in the root DIR.