Parrot/PGE, parsers Parsers, Perl 6 Rules, and the Parrot Grammar Engine #4

Syntax

We can use regexes to specify the valid patterns, or "syntax", for statements that appear in our language.

For example, if the following is a valid statement in our language

if a == 4 then print "Hello";

we want to be able to analyze the statement to parse out its components:

if                -- "if" keyword
  a == 4          -- an expression
then              -- "then" keyword
  print "Hello";  -- a statement
Copyright © 2006 Patrick Michaud