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 Kumar"

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

๐ŸŽ“ Built By

  • Yogesh Taparia - UEM Jaipur CSE

๐Ÿ“„ 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

yo_lang-1.0.0.tar.gz (15.3 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.0.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yo_lang-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b1113544272ddc9da77002f60877cd56c9141a2fcffe5960c9588df2e7412209
MD5 b967db7a16e4ad8e7ab0aa7b5dc3e80f
BLAKE2b-256 cd9c585b959a0bf76e83532efdb5986c80c4598c370338bfad797c6eb8a05e78

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yo_lang-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89e4ec32da510a17681c06c5d826a3b5768c961201970b04106d497871b25e4f
MD5 8c9ec2116eddec733c5a0411682a56ce
BLAKE2b-256 980e88b3a33ccbbbeea798c5bac36d720748e7c4d2c0723dda8d8f29e7de5e0d

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