official stupyd programming language package
Project description
StuPyd
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
-
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
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stupyd-0.0.2.tar.gz
.
File metadata
- Download URL: stupyd-0.0.2.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c59942870976549c769a761ea1a37e63f745f53ef15ac4bd5b18917d176d711 |
|
MD5 | 53564b287846933f06a2ee0dfb91cb6f |
|
BLAKE2b-256 | 9baca5ceaccdade0fcdd004f00dd61c3e933772a2eb86ef9769099ed41237ee3 |
File details
Details for the file stupyd-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: stupyd-0.0.2-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bfd7d0de86d32565bccf4f5720306cef7864f9de96c34c07e04402e78c97f94 |
|
MD5 | 3a70ca10240c4b438d4e0634938dbfb9 |
|
BLAKE2b-256 | 3aeaec7b7df11678b13762f978948b0def92d79e34eae14dd16c8c5e4e48ca6f |