*pyra

a comfy language

← return home

introduction to pyra

when i was a kid , i wanted to make computer games . i was told that , in order to make games , i'd need to use a language that was designed for computers first , not humans .

this upset me . i wanted to write in human language to make games ! i already knew how to describe things in English , so why did i need to learn a computer language that was so much harder to understand ?

rewriting

after years of struggling to find any programming language i felt comfortable with , i found a presentation on a language called Nova that uses a method called rewriting . it turns out that with rewriting , if you weave in just a little of the right kind of structure , you can describe your game world and how it changes using human language !

rewriting is an idea you've probably already used . it's find and replace . you start with some text , look for a pattern , and replace it with something else whenever it matches .

facts and rules

so what does find and replace look like in pyra ? let's start off with a program about bouncing a ball :

- throw bouncy ball

* throw bouncy ball
  - catch bouncy ball

this program starts off with a fact about the world : throw bouncy ball . in the first line , we add that fact to the world by adding a dash in front of it .

the other two lines are a rule . this rule looks for the throw bouncy ball fact , and if it exists , replaces it with catch bouncy ball . find and replace .

if you've understood that example , you've understood the core idea behind pyra , Nova , and rewriting !