Prequel

Primitive recursive driven programming

Prequel: primitive recursion driven; general recursion powered.

Inspired by the dawn of computer science, Prequel is a simple programming language.

Assignment, two control structures, and two datatypes. As simple as possible, but not simpler. Prequel is easy to follow.

       n := FACTORIAL.INPUT     
       result := 1              
       REPEAT n                 
        result *= n+1           
       ENDREP                   
       FACTORIAL.RETURN(result) 
    

The interpreter runs on JavaScript for a mobile-first approach.

Examples

Have a look at this Prequel primer and then get started with a range of examples that help illustrate the key features of Prequel.

Factorial

The traditional "Hello, World!" program written in Prequel would be:

      HELLO_WORLD.PRINT()
    

We start instead with another classic first program example: try the Factorial example here.

Let us know if you find interesting variations on calculating the factorial function in Prequel :)

Blinkp

Animate a line of 8 pixels; create visual effects with the available procedures.

Try the Blinkp example here.

Listsort

Sort a list in ascending order, given a custom procedure to move an element (LISTSORT.MOVE).

On a worst-case scenario, how many instructions does it take to sort a list of length ten? How about memory footprint? Edit the code. How does your program fare compared to the default provided?

Try the Listsort example here.

Ackermann

Prequel imposes a programming discipline that prohibits recursive calls and unbounded loops. The runtime system derives its Turing completeness from re-entering a module whenever the execution slips past its last instruction.

This scholastic example shows a Prequel implementation of the Ackermann-Péter function. The Ackermann function is one of the earliest-discovered total computable functions that is not primitive recursive.

Try the Ackermann example here.

More examples

Here are more advanced Prequel examples.

Maze

This is a puzzle where Theseus, after finding the Minotaur, has to escape back from the labirinth, except now, without Ariadne's string.

Guide Theseus out of the labirinth here.

Battleship

The century-old game Battleship can be used to practise Prequel skills.

Try the Battleship mechanics here.

ConnXxis

Rotate and swap tiles (or develop your own heuristics in Prequel) to find a better solution to this 34-digit search space puzzle, and enter the ConnXxis Hall of Fame.

Try this hexagonal tiles puzzle here.

Showcase

Play programming games by writing bots in Prequel.

AlgoDeduce

Figure out the relation between the input and the expected result in this inductive programming game.
Write and test your hypothesis using this Prequel programming laboratory.
The default programming challenge is updated every few weeks.

Deduce the algorithm.
Create your own generator.

WarpChase

Develop your own Prequel bot to play WarpChase.
Use the built-in debugger to test your code.

Try this programming game here.

GameBot.club

A hub for Prequel programming games.

Join the Prequel developers community at GameBot.club.

Tools

Standardizer

When all you need is a Prequel executable, use this tool to reduce a Prequel program to its essence.

Documentation

Primer

If you already know other imperative programming languages, this Prequel primer should be enough to get you started.

Talk slides

Here are the slides from a talk on Prequel, providing some context and the theoretical underpinnings of this programming language.

Grammar

Here you can find a BNF formally describing the syntax of a Prequel program.

Source code

The parser and interpreter for Prequel is available on GitHub.

About

Prequel stands for Primitive RECursive driven programming Language.

Prequel was created in 2017 by Hugo Simoes to provide his kids with the tool he wished to have had when starting to program.

Keep in touch, check out the author's website. Happy Prequel programming!