Skip to content
The reference interpreter for Procedural Footnote Language.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Procedural Footnote Language

An interpreter for Procedural Footnote Language, written in Dart.

Please note that this project is still work-in-progress and some features may not work as expected.

Getting Started

To get started with Procedural Footnote Language, first read the language specification.


Download the latest stable release of the PFL interpreter from the Releases section. Place the pfl.exe in a folder added to your PATH.

Important: The PFL interpreter is currently only available for Windows, and is packaged using dartbin.


To run a PFL program, execute the following command:

pfl filename.pfl

How it Works

The interpeter uses a loose interpretation of an abstract syntax tree to evaluate the final result of the document.

There is a class heirarchy of elements, each with an overriden evaluate method that, by default, evaluates all its children, concatenates the results, and returns:

/// Represents one node in the abstract syntax tree.
class Element {
    List<Element> children = new List<Element>();

    String evaluate() {
        String result = '';

        for (var child in children) {
            result += child.evaluate();

        return result;

Therefore, since the root document is also one of these nodes, evaluation of the entire document is as simple as calling evaluate on the root document.

Sample PFL Programs

Simple "Hello, world!"

[1] Hello, world!

Adding two numbers

[1:0:2] [INPUT]
[2:0:2] [INPUT]
[3] [ADD:[1]:[2]]

Primality test

[1:0:2] [INPUT]
[2] [PRIME:[1]]

99 Bottles of Beer

[1:98] [SUB:100:[INDEX:1]] bottles of beer on the wall, [SUB:100:[INDEX:1]] bottles of beer.[RET]Take one down, pass it around, [IF:[GT:[SUB:99:[INDEX:1]]:1]:[SUB:99:[INDEX:1]] bottles:1 bottle] of beer on the wall.[RET][RET][1]
[2] 1 bottle of beer on the wall, 1 bottle of beer.[RET]Take one down and pass it around, no more bottles of beer on the wall.[RET][RET]No more bottles of beer on the wall, no more bottles of beer.[RET]Go to the store and buy some more, 99 bottles of beer on the wall.[RET]

The Twelve Days of Christmas

The Twelve Days of Christmas[1][2][5][6][7][8][9][10][11][12][13][14][15]
[1:12] [RET][RET]On the [ORD:[INDEX:1]] day of Christmas my true love gave to me[RET]
[2] [IF:[IS:[INDEX:2]:1]:[4]:[3]]
[3] and [4]
[4] a partridge in a pear tree[RET][1]
[5] Two turtle doves[RET][2]
[6] Three french hens[RET][5]
[7] Four calling birds[RET][6]
[9] Six geese a laying[RET][8]
[10] Seven swans a swimming[RET][9]
[11] Eight maids a milking[RET][10]
[12] Nine ladies dancing[RET][11]
[13] Ten lords a leaping[RET][12]
[14] Eleven pipers piping[RET][13]
[15] Twelve drummers drumming[RET][14]

A few more examples can be found in the examples directory.




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


You can’t perform that action at this time.