Skip to main content

PyScript Programming Language

Project description

PyScript

PyScript Logo

PyScript is a simple programming language built on top of Python. It combines some syntax from Python and JavaScript, so if you're already familiar with Python or JavaScript, or both, it should be quite easy to learn.

Introduction

PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for running Python in a browser. Since it's inception, the language was inspired by Python and JavaScript, which are relatively easy for humans to read. This name was chosen because it wasn't immediately known whether this name was already in use.

This language wasn't designed to compete with other modern programming languages, but rather as a learning for understanding how programming languages ​​work and how human written code can be understood by machines. Furthermore, this language was created as a relatively complex project. Using Python as the foundation for PyScript, it's easy to understand how the language is built without having to understand complex instructions like those in C, C++, and other low-level languages.

To learn more about PyScript, you can see on PyScript documentation or PyScript repository for full source code.

Installation

First, you'll need to download Python. Make sure you're using the latest version above 3.10, to ensure the code runs correctly. Visit the official Python website to download it.

Next, after downloading and configuring the Python application, you can download the PyScript from PyScript releases or from Python Pip with this command (Recommended):

pip install -U pyscript-programming-language

[OPTIONAL] You can download additional libraries that PyScript requires with this command:

pip install -U pyscript-programming-language[other]

And also, you can download PyScript with git:

git clone https://github.com/azzammuhyala/pyscript
cd pyscript
python setup.py install

After that, you can run the PyScript shell (REPL) with this command:

python -m pyscript

If successful, you can see the version, release date, and a >>> like Python shell (REPL).

If you are using the VS Code editor, you can use the PyScript extension for Syntax Highlight!

Syntax

Familiar? There it is!

a = float(input("Enter a first number : "))
b = float(input("Enter a second number: "))
op = input("Enter an operation (+, -, *, /): ")

# functions
func add(a, b) {
return a + b
}

func sub(a, b) {
return a - b
}

func mul(a, b) {
return a * b
}

func floordiv(a, b) {
return b != 0 ? a / b : "Cannot be divided by 0!"
}

switch (op.strip())
{
case '+':
result = add(a, b)
print("Result of {} + {} = {}".format(a, b, result))
break

case '-':
result = sub(a, b)
print("Result of {} - {} = {}".format(a, b, result))
break

case '*':
result = mul(a, b)
print("Result of {} * {} = {}".format(a, b, result))
break

case '/':
result = floordiv(a, b)
print("Result of {} / {} = {}".format(a, b, result))
break

default:
print("Unknown operation")
}

Behind it

This language created from based up on a YouTube tutorial (check more on GitHub here by @davidcallanan). At least, it takes about 6 months to learn it, and also need to learn general things that exist in other programming languages.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyscript_programming_language-1.11.0.tar.gz (74.5 kB view details)

Uploaded Source

File details

Details for the file pyscript_programming_language-1.11.0.tar.gz.

File metadata

File hashes

Hashes for pyscript_programming_language-1.11.0.tar.gz
Algorithm Hash digest
SHA256 27440ecf0914f8016c3dce126fae49fdac0286bafb5e22c76c5ce4c73d450a16
MD5 bbefad60193e425cd06b0279b78b86b2
BLAKE2b-256 eb38d06ccd14c02fe57a6d97ee99bb1e32b33677a6b8292857e8617e9fca2d1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page