Skip to main content

A beginner-friendly interpreted programming language.

Project description

๐Ÿš€ YO Language

YO โ€” A Programming Language That Talks Like You

License: MIT Python Version Beginner Friendly


๐Ÿ“ What is YO?

YO is a beginner-friendly, dynamic programming language designed to make coding intuitive and fun. Built from scratch in Python, it prioritizes readability with conversational syntax and color-coded, actionable error diagnostics. It offers nested environments for functions, an interactive REPL mode, and built-in standard libraries for math, text, and lists.


โš™๏ธ Quick Install

YO runs on Python 3.10+. To install the required dependencies (primarily for colorized formatting), run:

pip install colorama

๐Ÿ‘‹ Hello World

Create a file named hello.yo and add the following code:

make greeting = "Hello World!"
say greeting

๐Ÿ“‹ Syntax Cheatsheet

1. Variables (make)

Declares a new variable. Reassign variables without the make keyword.

make name = "Yogesh"
name = "Yogesh Taparia"

2. Print Output (say)

Prints text or numbers to the console.

say "My name is " + name

3. Conditionals (when)

Executes code blocks based on conditions.

make age = 21
when age >= 18 {
    say "You are an adult"
} else {
    say "You are a minor"
}

4. Counted Loops (repeat)

Loops a block of code a specific number of times.

repeat 3 times {
    say "YO!"
}

5. List Loops (for each)

Iterates over elements in a list.

for each num in [1, 2, 3] {
    say num
}

6. Functions (task)

Declares reusable tasks with arguments and return statements.

task add(a, b) {
    return a + b
}

make sum = add(5, 10)
say sum

๐Ÿš€ Running YO

Run a Script

To run a .yo file, use the yo.py runner:

python yo.py myfile.yo
# OR
python yo.py run myfile.yo

Interactive REPL Mode

Running yo.py with no arguments boots up interactive mode:

python yo.py
YO v1.0 โ€” Interactive Mode
Type 'exit' to quit, 'clear' to reset variables
yo> make x = 5
yo> say x
5
yo> exit

๐Ÿ“š Standard Libraries

Load built-in standard libraries using the use keyword.

๐Ÿงฎ Math Library

Exposes: round, floor, ceil, power, sqrt, random, abs, min, max.

use math
say math.sqrt(25) # Outputs 5.0

๐Ÿ”ค Text Library

Exposes: upper, lower, length, reverse, has, trim, split, replace, starts_with, ends_with.

use text
say text.upper("hello") # Outputs HELLO

๐Ÿ“‹ List Library

Exposes: count, add, remove, sort, reverse, first, last, has, join.

use list
make my_list = [3, 1, 2]
say list.sort(my_list) # Outputs [1, 2, 3]

๐Ÿ“ Project Structure

yo-lang/
โ”œโ”€โ”€ stdlib/            # Standard Library Python modules
โ”‚   โ”œโ”€โ”€ list_lib.py    # List primitives
โ”‚   โ”œโ”€โ”€ math_lib.py    # Mathematical primitives
โ”‚   โ””โ”€โ”€ text_lib.py    # String primitives
โ”œโ”€โ”€ tests/             # Sample YO scripts
โ”‚   โ”œโ”€โ”€ test1.yo       # Basics test
โ”‚   โ”œโ”€โ”€ test2.yo       # Functions and lists test
โ”‚   โ””โ”€โ”€ test3.yo       # Standard libraries test
โ”œโ”€โ”€ environment.py     # Environment variable scope tracking
โ”œโ”€โ”€ errors.py          # Color-coded error styling & formatting
โ”œโ”€โ”€ interpreter.py     # AST execution engine
โ”œโ”€โ”€ lexer.py           # Handwritten scanner & tokenizer
โ”œโ”€โ”€ parser.py          # Handwritten recursive descent parser
โ”œโ”€โ”€ README.md          # Project documentation
โ””โ”€โ”€ yo.py              # CLI & REPL entrypoint

๐Ÿ” Error Messages: YO vs Python

YO was designed with beginner-friendly error messages to help first-time coders fix bugs faster. While Python stops at the first error with a traceback, YO collects multiple errors, suggests inline fixes (like typo corrections), and provides a built-in interactive explanation tool (yo explain).

See the full side-by-side comparison, design philosophy, and study results in comparison.md.


๐ŸŽ“ Built By

  • Yogesh Taparia - UEM Jaipur CSE

๐Ÿ“„ License

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

YO Tests PyPI License Python

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

yo_lang-1.1.0.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

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

yo_lang-1.1.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yo_lang-1.1.0.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for yo_lang-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9a4e74adceea33812d1c10d94f89e867cb59620ec81abb47a280ce2216c6c319
MD5 d1764fe13d44285d43f711ff3c67f81e
BLAKE2b-256 b7f3d507326b93cf0e952e529e85ecd03f3920fe44d8e82bd76dd8e556f55b7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yo_lang-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for yo_lang-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0023970a774e30727dc54698fe94fad624c2885ced672eab2919a45df44c37c
MD5 19b4aad3d639b05a6594b9c90bbcb737
BLAKE2b-256 d634fea6fce60a9dc4397607010d6fcb590288287991d5be567f4984fbc79fba

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