Skip to main content

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.

Metadata

Release files for stupyd 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stupyd 0.0.2
File Size Uploaded
stupyd-0.0.2.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stupyd 0.0.2
File Interpreter ABI Platform
stupyd-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.5 kB

Release files / stupyd-0.0.2.tar.gz

Download URL stupyd-0.0.2.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4c59942870976549c769a761ea1a37e63f745f53ef15ac4bd5b18917d176d711
BLAKE2b-256 checksum
How to use checksums
9baca5ceaccdade0fcdd004f00dd61c3e933772a2eb86ef9769099ed41237ee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/18.5 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.10

Release files / stupyd-0.0.2-py3-none-any.whl

Download URL stupyd-0.0.2-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bfd7d0de86d32565bccf4f5720306cef7864f9de96c34c07e04402e78c97f94
BLAKE2b-256 checksum
How to use checksums
3aeaec7b7df11678b13762f978948b0def92d79e34eae14dd16c8c5e4e48ca6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/18.5 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.10

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page