Fpl is a lex/yacc/bison alternative, born of my frustration with those tools and of reading about other parser generators (such as https://pdos.csail.mit.edu/~baford/packrat/thesis/).

A more logical excuse for fpl is that at some point jest needs to be rewritten in jest, and if I use existing parser generator languages, I'm going to be tied to c or whatever language those parser generators generate. So I need something which will generate jest (unless I want to code the parser by hand, which is possible).

Key differences from other existing parser generators:
fpl gramatical elements:
Directives

Valid directives are:

Production rules

Production rules are of the form:

        <exprs to match> -> <production name> { <code> }
                   or
        <exprs to match> -> <production name> ;
      
Expressions may be any of:

The first 2 effectively specify scan tokens. Single or double quotes are equivalent, and specify an exact match to look for. Regular expressions can be used to specify The third case specifies

Expressions may be followed directly by (no space) one of *, +, or ? to mean 0-or-more, 1-or-more, or 0-or-1 respectively.

Examples:
        # a very basic calculator

        @produces int

        aexpr '+' mexpr -> aexpr +{ return arg_0 + arg_2; }+
        aexpr '-' mexpr -> aexpr +{ return arg_0 - arg_2; }+
        mexpr           -> aexpr ;

        mexpr '*' term  -> mexpr +{ return arg_0 * arg_2; }+
        mexpr '/' term  -> mexpr +{ return arg_0 / arg_2; }+
        mexpr '%' term  -> mexpr +{ return arg_0 % arg_2; }+
        term            -> mexpr ;

        '-' term        -> term +{ return -arg_1; }+
        '(' aexpr ')'   -> term +{ return arg_1;  }+
        /[0-9]+/        -> term +{
            return std::stoi(arg_0);
        }+

      

* With regular expressions, you can trick fpl2cc into having ambiguous, "secretly" equivalent, or overlapping tokens. For example, it won't know that /[1-3]/ and /[123]/ are equivalent or that /[a-z]+/ and /[a-f]+/ can both match some of the same strings. In practice this mostly does not matter, but I recommend you keep your regexes tidy and minimal to avoid any surprises.