Welcome to Clyp: An Introduction
Clyp is a modern, expressive programming language designed for developers who appreciate the power of Python but desire a cleaner, more streamlined syntax. It transpiles directly to high-performance, readable Python, allowing you to seamlessly leverage the vast Python ecosystem.
Why Clyp?
Clyp was created to blend the simplicity and readability of modern languages with the robustness of Python's ecosystem. Here’s why you might love it:
- Clean and Expressive Syntax: Clyp reduces boilerplate and syntactic noise, making code easier to write and maintain.
- Strong Typing, Your Way: Enforce type safety with explicit type declarations or enjoy flexibility with type inference.
- Seamless Python Interoperability: Use any Python library or framework effortlessly. Your Clyp code becomes Python code, so there are no barriers.
- Performance: By transpiling to optimized Python and leveraging Cython for compilation, Clyp aims for excellent performance.
How It Works
Clyp is a transpiled language. When you write Clyp code, the clyp
command-line tool translates it into equivalent Python code. This Python code is then executed by the Python interpreter. This approach means you get the performance and reliability of Python, plus access to its incredible collection of libraries, all while working in a language designed for clarity.
Getting Started
To start using Clyp, you need to have Python and pip
installed.
Install Clyp:
pip install clyp
Verify Installation:
clyp --version
Your First Clyp Program
Let's create the traditional "Hello, World!" program. This example demonstrates basic variable declaration and printing to the console.
Create a file named hello.clyp
and add the following code:
# A simple "Hello, World!" program in Clyp
str name = "World";
print(f"Hello, {name}!");
Code Breakdown:
str name = "World";
: This line declares a variable namedname
of typestr
(string) and assigns it the value"World"
.print(f"Hello, {name}!");
: This calls the built-inprint
function. Thef
before the string indicates a formatted string, which allows you to embed variable values directly inside it using{}
.
To run your program, use the go
command:
clyp go hello.clyp
You should see the output: Hello, World!
Python Equivalent
For comparison, here is the Python code that Clyp generates:
# A simple "Hello, World!" program in Python
name: str = "World"
print(f"Hello, {name}!")
As you can see, Clyp maintains a close relationship with Python's syntax but introduces its own conventions to enhance the developer experience.