Skip to main content

Whilelang

Usage: python while.py source.while [...arguments]

Implemented grammar

The grammar implemented here is slightly different to the definitions of While that can be found online, largely for ease of implementation.

<suite> = EOF
        | "(" <suite> ")"
        | <statement> *(";" <statement>)
<statement> = "skip"
            | "while" <expr_a> "do" <suite>
            | "if" <expr_a> "then" <suite> ["else" <suite>]
            | NAME ":=" <expr_a>
            | <directive>
<directive> = "@" ("trace" | "exit" | "print" NAME)
<factor> = [("!" | "¬")] (NAME | NUMBER | BOOLEAN | "(" <expr_a> ")")
<expr_f> = <factor> [("*" | "/") <factor>]
<expr_e> = <expr_f> [("+" | "-") <expr_f>]
<expr_d> = <expr_e> [("<=" | "<" | ">=" | ">") <expr_e>]
<expr_c> = <expr_d> ["=" <expr_d>]
<expr_b> = <expr_c> ["&" <expr_c>]
<expr_a> = <expr_b> ["|" <expr_b>]

This logic can be seen implemented as code in parser.py. Compared to the simpler grammars often quoted, this grammar provides proper operator precedence.

Release files for whilelang 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 whilelang 0.0.2
File Size Uploaded
whilelang-0.0.2.tar.gz 8.1 kB Details

Built distribution (wheel)

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

Total release size: 17.5 kB

Release files / whilelang-0.0.2.tar.gz

Download URL whilelang-0.0.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
de04c68df0f16270aec630aea961462fb2d9af712b3ddb3f5c06c0356249b375
BLAKE2b-256 checksum
How to use checksums
afb544d0ce21ffd176492463d46bfdfe8cd61f59e6e64d9c4f157c80f4cc28b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0

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

Download URL whilelang-0.0.2-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2893dcdfa530728fd8225a37170a05785e8d4223da85e7eb35bd3df9d1dc26ff
BLAKE2b-256 checksum
How to use checksums
c7e18623d43d6071173d36ceca12b40f94681ce13c28cddb3a5788825ba7cee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0

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