Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

official stupyd programming language package

Project description

StuPyd

PyPI pyversions Build PyPI status License Debugger

StuPyd is an interpreted high-level programming language for programming education. It is intended to have a easy-to-read syntax and useful intergrated data structures with related operation methods to help its users to understand programming and other related computer science concepts.

You can get more information on our project page.

Getting Started

These instructions will lead you to install stupyd-interpreter on your machine.

Prerequisites

  1. StuPyd is based on Python3, thus you must have Python3 (3.6.0 or higher) installed first. You can check your version with:

    ➜  ~ python3 -V
    
  2. The stupyd-interpreter is released on PyPI, thus you need to install pip first. you can see installation guide here

Installing

Our PyPI page is here. You can easily install the stupyd-interpreter with:

➜  ~ pip install stupyd

After installation, type "stupyd" in terminal, you should see:

➜  ~ stupyd
usage: stupyd [-h] filename

positional arguments:
  filename    path of source code

optional arguments:
  -h, --help  show this help message and exit

Now you can run StuPyd code on your machine :)

Running the code

Let's write a simple "hello_world.sp":

string str
"hello, world" -> str
print(str)

We can run this code by:

➜  stupyd-lang git:(master) ✗ stupyd test/hello_world.sp
The stupyd-interpreter.

"hello, world!"

Test on local machine

For all the code in this repository is for packaging, you can not run them directly. To test the code, you have two methods.

Re-package on local machine

Step1: Re-package in local environment

➜  stupyd-lang git:(master) ✗ python3 setup.py sdist bdsit_wheel

Step2: Install local wheel using pip

➜  stupyd-lang git:(master) ✗ pip3 install dist/stupyd-1.0.14-py3-none-any.whl

Using run.py

During our development, we write a run.py in the test/ directory, it's very simple.

import sys 
sys.path.append("..") 
from stupyd.main import main

main()

You can use it to test.

➜  test git:(master) ✗ python3 run.py hello_world.sp
"hello, world!"

Debugging

From version 1.0.18, you can debug source file with stupyd-debugger. After installation, type 'spd' to launch it, below is an example:

➜  stupyd-lang git:(master) ✗ spd test/hello_world.sp
The stupyd-debugger. Type 'help' or '?' for help.

spd >> ?

Documented commands (type help <topic>):
========================================
break  help  info  next  quit


spd >> ? info
print program general info

spd >> info
constant space: ['"hello, world!"']
variable space: ['a']

index     ins_num   op_num    instruction         operator
0         1         0         DECL_FAST           a
2         17        0         LOAD_STRING         "hello, world!"
4         2         0         STORE_FAST          a
6         3         0         LOAD_FAST           a
8         7         -1        PRINT               none
10        13        -1        QUIT                none

spd >> next
current instruction:
index     ins_num   op_num    instruction         operator
0         1         0         DECL_FAST           a
variables:{}
data stack:[]

spd >> break 10
"hello, world!"
current instruction:
index     ins_num   op_num    instruction         operator
10        13        -1        QUIT                none
variables:{'a': '"hello, world!"'}
data stack:[]

spd >> next
program ended.

spd >> quit

➜  stupyd-lang git:(master) ✗

It's just a simple and function-incompleted debugger for now, we will make it better later.

More information about StuPyd bytecode instruction and stupyd-interpreter will be updated later on our project page.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

We are a group from School of Information Science and Engineering, Lanzhou University, China.

Project details


Download files

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

Files for stupyd, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size stupyd-0.0.2-py3-none-any.whl (19.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size stupyd-0.0.2.tar.gz (17.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page