Code Monkey home page Code Monkey logo

diamond-programming-language's Introduction

Diamond Programming Language

Requirements to run Diamond

  • All needed right now is nothing but the python programming langauge, and you could learn how to download and set it up here

Usage (Diamond PL)

How to run

Mac or Linux

./diamond.sh <diamondfilename>

What to write to run the codes:

python execute.py <diamondfilename>

Windows

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.

Syntax

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.

Functions

The current functions for diamond are:

spill

Task: Print this in the console
Arguments will be like :

  • text: e.g (hello world)

Sample: spill Hello, World!

create_variables in Diamond

Create a variable in diamond


Arguments: - name: Variable name - value: Variable value. Could be a existing variable or string before

Example: create_variable dior "this is me"

create_function

Description: Creates a function
Arguments:

  • name: Name the function

Example:

create_function my_world:
    spill "hello"

when you wanna execute a function?:

# Type the function's name down
my_world

import a file in diamond

Task: Import another file into your own file
Arguments:

  • The filename: The name of the file you want to import could end with .diamonod or maybe not.

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

python_run

Task: Runs a line of Python code in the diamond environment.
Arguments:

  • query: The query that you want to run.

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.

Author John Oseni

diamond-programming-language's People

Contributors

johnoseni1 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.