Skip to content

HiteshSharma-github/Pysack--Programming-Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


PySack

A programming Language written in python. Runs file with extension as hit. Code In Place Submission

Target

An educational aid for junior IT students for introduction of python.

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-hit-file>

test

You also have 2 other options:

Windows

hit <name-of-hit-file>

Mac or Linux

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

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

python execute.py example.hit

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

Syntax

The basic syntax for a Hit 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 Hit.

Functions

The current functions for Hit 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 .hit or not.

Example: import helloworld

Inside helloworld.hit, 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 Hit 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.hit file.

Happy Coding !

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages