Code Monkey home page Code Monkey logo

cobra's Introduction

No longer maintained. See #3


Cobra

My own programming written in Python (now you see why it's called Cobra).

Requirments

Right now, no external modules are needed. You just need the Python programming language.

Usage

How to run

All you have to do is:

python execute.py <name-of-cobra-file>

You also have 2 other options:

Windows

cobra <name-of-cobra-file>

Mac or Linux

./cobra.sh <name-of-cobra-file>

I have an example.cobra file in the root directory of this repository. You can run it by running the following command in your terminal:

python execute.py example.cobra

or by using the other two options above: Windows, Mac or Linux.

Syntax

The basic syntax for a Cobra program is: name of function any arguments to be passed in to the function. That's a bit confusing. So for example, if you type say Hello, World!, say is the function and Hello, World! is the argument. To create a comment, use the # sign. For example: # This is a comment. It will be ignored by Cobra.

Functions

The current functions for Cobra are:

say

Description: Print to the console
Arguments:

  • text: Text to print out to the console.

Example: say Hello, World!

create_var

Description: Creates a variable
Arguments:

  • name: Variable name
  • value: Variable value. Can be an existing variable or string.

Example: create_var test "This is a test"

create_function

Description: Creates a function
Arguments:

  • name: Function name

Example:

create_function say_hello:
    say "hello"

To execute a function:

# You just type the function's name
say_hello

import

Description: Imports a file into your current executing program.
Arguments:

  • filename: The name of the file you want to import. Can end with .cobra or not.

Example: import helloworld

Inside helloworld.cobra, there is a function called testing_func. To run it, just type it in like usual.

import helloworld
testing_func

The import function will always import everything as of this commit.

run_python

Description: Runs a line of Python code in the Cobra environment.
Arguments:

  • query: The query that you want to run.

Example: run_python "print('Hello World!')"

This is meant for compatibility with Python.

For examples of all of these functions, consult the example.cobra file.

cobra's People

Contributors

techstudent10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cobra's Issues

Update README.md

Currently, it's set as python execute.py as the first option to run but wont, python3 do the same thing? Why is execute.py needed?

Cobra programming language already exists

https://en.wikipedia.org/wiki/Cobra_(programming_language)

Cobra is an open-source project; it was released under the MIT License on February 29, 2008

Cobra is a discontinued general-purpose, object-oriented programming language.[1] Cobra is designed by Charles Esterbrook, and runs on the Microsoft .NET and Mono platforms.[2] It is strongly influenced by Python, C#, Eiffel, Objective-C, and other programming languages.[3] It supports both static and dynamic typing.[4][5] It has support for unit tests and contracts.[4] It has lambda expressions, closures, list comprehensions, and generators.[6]

^From wikipedia

Missing Functions, numerous things not defined.

Not sure if this is a problem on my end or anything, but there are undefined statements in a lot of the files.

'functions[function_name] = function_lines' in create_function.py.
'variable_not_found(var_value)' in create_variable.py.

etc.

Function Indentation Issue.

Hello all!
So quick tip: when creating a function, be sure to use four spaces ( ) for the indentation. This is an issue that I am currently working on. Have it fixed? Create a pull request for it!

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.