Skip to main content

No project description provided

Project description

BhauLang

BhauLang is a toy programming language inspired by BhaiLang. It includes basic constructs for variable declaration, printing, conditionals, and loops.

Features

  • Variable declaration
  • Printing to the console
  • Conditional statements (if, else if, else)
  • While loops

Installation

You can install BhauLang directly from PyPI:

pip install BhauLang

Usage

After installing the package, you can run .bhau files using the bhau command. For example:

bhau example.bhau

Syntax

Variable Declaration

Declare a variable using he bagh followed by the variable name and value:

he bagh a = 10
he bagh name = "hello"

he bagh: This keyword is used to declare a new variable.

Printing

Print to the console using bol:

bol (a)
bol ("Hello, world!")

bol: This keyword is used to print the value of an expression or variable to the console.

Conditionals

Use jar, nasel tar, and nahi tar for conditional statements:

jar (a < 10) {
    bol ("yes less than 10")
}
nasel tar (a < 20) {
    bol ("yes less than 20")
}
nahi tar {
    bol ("not less than 10 or 20")
}
  • jar: This keyword is used for the if condition. If the condition is true, the block of code within the braces {} is executed.
  • nasel tar: This keyword is used for the else if condition. If the previous if or else if condition was false, and this condition is true, the block of code within the braces {} is executed.
  • nahi tar: This keyword is used for the else condition. If none of the previous if or else if conditions were true, the block of code within the braces {} is executed.

While Loops

Use joparyanta for while loops:

joparyanta (a < 5) {
    bol (a)
    a = a + 1
}

joparyanta: This keyword is used for a while loop. The loop continues to execute the block of code within the braces {} as long as the condition is true.

Examples

  • Example 1 :
he bagh a = 10
bol (a)
jar (a<10){
    bol ("yes less than 10")
}
nasel tar (a<20){
    bol ("yes less than 20")
}
nahi tar{
    bol ("not less than 10 or 20")
}

Expected Output:

10
yes less than 20
  • Example 2
he bagh name = "hello" 
bol (name)
he bagh number = 56
bol (number)

Expected Output:

hello
56
  • Example 3
he bagh a = 0
joparyanta ( a<5 ){
    bol (a)
    a = a + 1
}

Expected Output:

0
1
2
3
4
  • Example 4
he bagh countdown = 4
joparyanta (countdown > 0){
    bol (countdown)
    countdown = countdown - 1
}

Expected Output:

4
3
2
1

BhauLang does not handle errors gracefully. It may crash or produce unexpected behavior if incorrect syntax or unsupported features are encountered.

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

BhauLang-0.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

BhauLang-0.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file BhauLang-0.2.tar.gz.

File metadata

  • Download URL: BhauLang-0.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.6

File hashes

Hashes for BhauLang-0.2.tar.gz
Algorithm Hash digest
SHA256 15f8b60959f41f996c304d141a0f85501812ee867e87f72bdbc5b7f536cd1c13
MD5 3799fcff4be0bc5c75f360c1797753c7
BLAKE2b-256 a7c4deb7a00391f14c5de5ec35aa70a86c7b860e68ef674e3015ebd102b9f665

See more details on using hashes here.

File details

Details for the file BhauLang-0.2-py3-none-any.whl.

File metadata

  • Download URL: BhauLang-0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.6

File hashes

Hashes for BhauLang-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 791e5ae4f68ea64c4d888891ee65610a2d43ed79cad31c96c5f2a33c21429a67
MD5 f669be2703ffe6fef64003e98685bbfd
BLAKE2b-256 2ed22b32294020365e4294b383b8292aa254e514d4705c7f14ccdc5adb1f9326

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