Getting Started with Lyric

(note: lyric is not publicly released yet.)

Lyric is a modern programming language designed for clarity and expressiveness.
In this short tutorial, you’ll install Lyric, write your first program, and learn the basics of its syntax.


Installing Lyric

Lyric requires Python 3.10 or later.

  1. Lyric can be installed using pip (coming soon)
pip install lyric-lang
  1. Your First Lyric Program

Create a file called hello.ly:

def main() {
    print("Hello from Lyric!")
}

Then run your script

lyric hello.ly
  1. Variables and Functions
def square(int n) {
    return n * n
}

def main() {
    int x = 5

    print(square(x))
}
  1. Conditional Blocks
def main() {
    int x = 10
    
    if x < 10
        print("less than")
    else
        print("not less than")
    end
}
  1. Control Flow
def main() {
    int total = 0
    given i in range(5):
        total += i
    done
    print(total)
}
  1. Using Python Modules
importpy math

def main() {
    print(math.sqrt(16))
}
  1. Exception Handling
def main() {
    var items = [1, 2, 3]

    try:
        var x = items[5]          # will raise an error
        print("This won't run.")
    catch:
        print("Something went wrong.")
    finally:
        print("Cleanup runs no matter what.")
    fade
}
  1. Next Steps

Thank you

Thank you for exploring Lyric — we hope this tutorial helped you understand the language’s clarity and simplicity.
Lyric is still evolving, and your interest and feedback help shape its future.

← Back