NAME ^

PunieGrammar -- A grammar for parsing Perl 1

SYNOPSYS ^

  .sub _main :main
      load_bytecode 'PunieGrammar.pir'
      .local pmc start_rule
      .local pmc match
      .local string source
 
      # Perl 1 source code
      source = 'print 1;'

      # Retrieve the start rule
      start_rule = find_global 'PunieGrammar', 'prog'

      # Parse the source and return a match object
      match = prog(source)

      ... # Do something with the parse tree

      end
  .end

DESCRIPTION ^

This is a grammar to parse Perl 1 programs. It inherits the behavior of the PGE::Grammar class. It parses a string of source code according to its hierarchy of rules and returns a PGE::Match object (a parse tree).

LICENSE ^

Copyright (C) 2005, The Perl Foundation.

This is free software; you may redistribute it and/or modify it under the same terms as Parrot.

AUTHOR ^

Allison Randal <allison@perl.org>


parrot