Skip to main content

Krash Programming Language - An interpreted language with clear, readable syntax

Project description

Krash Programming Language v1.0

Krash is an interpreted programming language written in Python with clear, readable syntax and short code lines.

Features

  • Readable Syntax - Clean, intuitive syntax similar to Python
  • Strict Typing - Type checking prevents subtle bugs
  • Built-in Libraries - mathBasic, ArraysAndStrings, HTTPClient, FileUtils, JSONParser, DateUtils, Random
  • Format Strings - Powerful string interpolation with showf
  • Error Handling - Try/catch blocks for robust error handling
  • File I/O - Built-in file reading and writing
  • HTTP Requests - Make GET, POST, PUT, DELETE requests
  • JSON Support - Parse and generate JSON data

Installation

pip install krash-lang

Quick Start

Hello World

show "Hello, World!"

Variables and Math

str name = "Alice"
int age = 28
showf "Name: {name}, Age: {age}"

Arrays

int[] scores = [85, 92, 78, 95, 88]
showf "Total: {scores.length()} items"
showf "First: {scores[0]}"

Functions

fxn>: add(int a, int b):
    givef "{a + b}"
<:

int result = add(10, 20)
showf "Result: {result}"

Control Flow

int score = 85

if>: score >= 90:
    show "Grade: A"
<: elif>: score >= 80:
    show "Grade: B"
<: else>:
    show "Grade: C"
<:

Dictionaries

mydict{} = {
    "name": "Alice",
    "age": 28
}

showf "Name: {mydict{"name"}}"
showf "Age: {mydict{"age"}}"

Error Handling

try>:
    int x = int("not a number")
<: catch>: ValueError:
    show "Invalid number!"
<:

File I/O

write>: "Hello, World!":
    .new("hello.txt")
<:

read>: ("hello.txt"):
    showf "Content: {read.getFirstLine()}"
<:

HTTP Requests

#HTTPClient

try>:
    str response = HTTPClient.get("https://api.example.com/data")
    showf "Response: {response}"
<: catch>: NetworkError:
    show "Request failed"
<:

Standard Libraries

Library Description
#mathBasic Basic arithmetic (add, subtract, multiply, divide)
#ArraysAndStrings Array/string utilities (capitalize, reverse, join)
#HTTPClient HTTP requests (get, post, put, delete, patch)
#FileUtils File operations (exists, copy, rename, list)
#JSONParser JSON parsing (parse, stringify, getString)
#DateUtils Date/time (today, time, daysUntil, addDays)
#Random Random generation (integer, float, boolean, item)

Running Programs

# Run a Krash file
krsh program.ksh

# Start interactive mode
krsh

# Show version
krsh --version

# Show help
krsh --help

Language Syntax

Comments

// Single line comment

/ Multi line comment
that spans multiple lines /

Block Syntax

Krash uses >: and <: for code blocks:

if>: condition:
    // code block
<:

Indentation

Krash requires 4-space indentation inside blocks:

for>: int i = 0, i < 5, i++:
    showf "{i}"      // 4 spaces
<:

License

MIT License

Author

Krash Community

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

krash_lang-1.0.0.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krash_lang-1.0.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file krash_lang-1.0.0.tar.gz.

File metadata

  • Download URL: krash_lang-1.0.0.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for krash_lang-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2626e12bafbba8ed775361721e246cbd6d16fc351ce5465ee79222e87766afa7
MD5 5be0cb98635d14726d2e03323f78aaed
BLAKE2b-256 e2c45e8a30676bc0b384a3c5da39042e60097b729844448b3ce45906ee8c9c74

See more details on using hashes here.

File details

Details for the file krash_lang-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: krash_lang-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for krash_lang-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22b19a1e65ef0b5e582e61c1f85e17f373e339acf6fbdbffcf67d397e83b8d2e
MD5 352f49552aaf19082ffc266ad6a22a14
BLAKE2b-256 912b0ccdb3939cf5e564603c6016e6f91fdb8362ed9fab99e95d153806cc71a3

See more details on using hashes here.

Supported by

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