Skip to main content

The Sheng programming language: A Chinese programming language

Project description

The Sheng Programming Language

sheng build python pypi license

结绳:在文字产生之前,古人们靠结绳记事、认事,此举起到了帮助人们记忆的作用。

Sheng is a Chinese programming language named after 结绳 (Jie Sheng), which means tying knots in ropes. In ancient China, before the creation of characters and words, the people remembered and recognized things by tying knots in ropes, which helped them memorize.

The philosophies of the Sheng grammar are interpretable, colloquial, and less punctuation marks. The compiler is implemented in Python with the PLY (Python Lex-Yacc) package which processes lexing and parsing in the phases of the compilation.


Usage

sheng [option] [file]

Installing and Running

Note: Sheng requires Python 3.9 or later

PyPI [Recommended]

Install the Sheng compiler from The Python Package Index (PyPI):

Note: This method requires Internet access.

pip install sheng

Then, execute command sheng [option] [file] to run.

Other install methods

Build and install

Build the code and install the Sheng compiler from the local builds:

Note: This method does not require Internet access.

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python3 -m build
pip install ./dist/<.whl file> --force-reinstall

Then, execute command sheng [option] [file] to run.

Run the compiler module via Python

Run the compiler directly without building and installing in advance:

Note: This method requires Python 3.9 or later in your environment.

python3 -m src [option] [file]

Getting Started

This is the Sheng code in example/helloworld.zh:

甲 赋值 "你好,世界!"
打印(甲)

The first line is an assignment statement where is a variable name which is 赋值 (assign)ed a string value 你好,世界! (Hello, World!) surrounded by " (double quotes). The second line is a function call statement which calls the built-in function 打印 (print) to output the value of the variable .

This is the Python equivalent of the above Sheng code:

x = "你好,世界!"
print(x)

Compile the .zh file via sheng executable:

sheng example/helloworld.zh

You should see the following output in stdout:

你好,世界!

Contributing

I am excited to work alongside you to build and enhance the Sheng Programming Language!

BEFORE you start work on a feature/fix, please read and follow the Contributor's Guide to help avoid any wasted or duplicate effort.


Code of Conduct

This project has adopted the Contributor Covenant Code of Conduct. For more information contact luo@jiahai.co with any additional questions or comments.

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

sheng-0.1.15.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

sheng-0.1.15-py3-none-any.whl (54.7 kB view details)

Uploaded Python 3

File details

Details for the file sheng-0.1.15.tar.gz.

File metadata

  • Download URL: sheng-0.1.15.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for sheng-0.1.15.tar.gz
Algorithm Hash digest
SHA256 6e8a43940085d0c260854db8cb5dcd42d761748c279a92b823fd7a80f941b11f
MD5 a8cc1b4435f782fc303f5648430c2671
BLAKE2b-256 72e1f6bb15bf6cbb0daa5f5b8c30368a29bd1946a861a52d792b2ee30c8e5d77

See more details on using hashes here.

File details

Details for the file sheng-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: sheng-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 54.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for sheng-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 d09109abaeb32e0759acce96ae5dcc0a6c12f6243a786653eb5c579578ffe013
MD5 f50689e9329de28044ae83abf3202b39
BLAKE2b-256 24333929738eeb7895928a5584c657c4e2a0d9ed5af9fe2a72c1dd6bebe5afd7

See more details on using hashes here.

Supported by

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