Skip to main content

Clyp is a programming language that transpiles to Python.

Project description

Clyp

Clyp is an experimental programming language that transpiles to Python. It's designed with a clean and simple syntax, aiming to make coding more straightforward and readable.

Site at codesoft.is-a.dev/clyp/

Features

  • Static-like Typing: Variables are declared with their types, providing clarity and robustness.
  • Simplified Syntax: Uses {} for blocks and ; for newlines, similar to C-like languages.
  • Python Interoperability: Seamlessly uses Python libraries and functions.
  • Standard Library: Comes with a handy set of built-in functions for common tasks.

Installation

To get started with Clyp, you need to have Python installed. Then, you can install Clyp using pip:

pip install clyp

Want to install from source? Clone the repository and run:

git clone https://github.com/CodeSoftGit/clyp.git
cd clyp
pip install -r requirements.txt

Usage

The Clyp CLI allows you to execute .clyp files directly from your terminal.

  • Run a file:

    clyp go path/to/your/file.clyp
    
  • Check the version:

    clyp --version
    
  • Display help:

    clyp --help
    

Language Syntax

Variables

Variables are declared with their type followed by the name and value.

int x = 10;
str message = "Hello, World!";
bool is_active = true;

Functions

Functions are defined using the def keyword, with type hints for arguments and a returns clause for the return type.

def greet(str name) returns None {
    print("Hello, " + name);
}

Conditionals

Clyp uses if, else if, and else for conditional logic.

int a = 10;
if (a > 5) {
    print("a is greater than 5");
} else {
    print("a is not greater than 5");
}

Comments

Comments start with #.

# This is a single-line comment

Standard Library

Clyp includes a standard library with useful functions:

  • fetch(url: str): Fetches content from a URL.
  • read_file(path: str): Reads a file's content.
  • write_file(path: str, content: str): Writes content to a file.
  • slugify(text: str): Converts a string into a URL-friendly slug.
  • is_empty(value): Checks if a value is empty.
  • is_prime(n: int): Checks if a number is prime.
  • to_roman_numerals(num: int): Converts an integer to Roman numerals.

Development

To contribute to Clyp, you can set up a development environment:

pip install -r requirements-dev.txt

Run tests using pytest:

pytest

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

clyp-1.1.0.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

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

clyp-1.1.0-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file clyp-1.1.0.tar.gz.

File metadata

  • Download URL: clyp-1.1.0.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clyp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 31043b17e95c9678230cf5cb157e460af6db34e59c85eec5c3a582cf68be6ec0
MD5 ccc211ae9d4b4d4917349f7969f524a5
BLAKE2b-256 dc6a3f0179659881bdca777d169d865f9b73a6316d97810aab82479e2af227d7

See more details on using hashes here.

File details

Details for the file clyp-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: clyp-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clyp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5451402fdfcae66fd27a3488aaaa33fd39a7e24a6df05b66bde43eab7bf286bf
MD5 efc9bafaf9b458e4314da7683c6bb36f
BLAKE2b-256 a3f52f79fa72d2ea35588f56b8f9f46bb3811a5d2b9f4850a5711c294aa78470

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