The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lang::Tree::Builder::Parser - Parse Tree Definitions

SYNOPSIS

  use Lang::Tree::Builder::Parser;
  my $parser = new Lang::Tree::Builder::Parser();
  my $data = $parser->parseFile($datafile);

DESCRIPTION

A parser for class definitions. The data file input to the parse method has the following simple format:

  # a comment
  [abstract] [<parent>] <class>(<class> [<name>], ... )
  ...

for example

  # this class has no base class and is initialized with a scalar
  IntNode(scalar)
  # the list class is abstract
  abstract List()
  # this class is a type of List and takes initializers Foo::Node and Foo::List
  List Foo::List(Foo::Node first,
                 Foo::List rest)
  # this class is an abstract type of List and takes no initializers
  List EmptyList()

apart from arbitrary class names as initializers, the keyword scalar is recognized.

new

  my $parser = new Lang::Tree::Builder::Parser;

Creates and returns a new instance of a parser.

parseFile

  my $data = $parser->parseFile($datafile);

Parses $datafile and returns an instance of Lang::Tree::Builder::Data

SEE ALSO

Lang::Tree::Builder

AUTHOR

Bill Hails, <me@billhails.net>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Bill Hails

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.