The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Pegex Syntax

Pegex has a fairly simple set of syntax constructs. This document details them all.

A Pegex grammar is just a set of named rules. They look like this

    rule_name_1: <rule>* <body> /1/
    rule_name_2: /rule body 2/

A rule is a name followed by a ':' followed by a rule body. It can optionally end with a semicolon, if you want to put more than one on a line.

Basic Tokens

Pegex only has 3 kinds of basic tokens:

Rule Reference

A rule reference is the name of a rule inside angle brackets.

    <sub_rule_name>
Regular Expression

A regular expression is a string inside forward slashes.

    /regular expression/
Error Message

An error message is a string inside backticks.

    `error message`

More to come...

1 POD Error

The following errors were encountered while parsing the POD:

Around line 6:

Unknown directive: =head