Skip to main content

The Sheng programming language: A Chinese programming language

Project description

结绳 The Sheng Programming Language

build python pypi license

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

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

The philosophies of the Sheng grammar are interpretable, colloquial, and virtually none 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.

sheng-logo


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:

语句 赋值 字符串 开始 你好,世界! 结束
打印 语句

where 语句 (phrase) is a variable name which is 赋值 (assign)ed a 字符串 (string) value 你好,世界! (Hello, World!) surrounded by 开始 (begin) and 结束 (end) keywords.

The above Sheng code can be interpreted in English as:

phrase assign string begin Hello, World! end
print phrase

This is the Python equivalent of the above Sheng code:

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

Compile the .zh file via sheng executable:

sheng example/helloworld.zh

You should see the following output in stdout:

你好,世界!

Grammar

See the Sheng Grammar documentation.


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.1.tar.gz (41.0 kB view hashes)

Uploaded Source

Built Distribution

sheng-0.1.1-py3-none-any.whl (43.7 kB view hashes)

Uploaded Python 3

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