Grammar-Graph

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

         }
      },
      "runtime" : {
         "requires" : {
            "Grammar::Formal" : "0",
            "Graph" : "0",
            "Graph::SomeUtils" : "0",
            "List::MoreUtils" : "0",
            "List::Util" : "0",
            "List::UtilsBy" : "0",
            "Modern::Perl" : "0",
            "Moose" : "0",
            "Storable" : "0",
            "Test::More" : "0",
            "perl" : "5.012"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "repository" : {

META.yml  view on Meta::CPAN

  directory:
    - t
    - inc
requires:
  Grammar::Formal: '0'
  Graph: '0'
  Graph::SomeUtils: '0'
  List::MoreUtils: '0'
  List::Util: '0'
  List::UtilsBy: '0'
  Modern::Perl: '0'
  Moose: '0'
  Storable: '0'
  Test::More: '0'
  perl: '5.012'
resources:
  repository: https://github.com/hoehrmann/Grammar-Graph.git
version: '0.20'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;

WriteMakefile(
  MIN_PERL_VERSION  => 5.012000,
  NAME              => 'Grammar::Graph',
  VERSION_FROM      => 'lib/Grammar/Graph.pm',
  PREREQ_PM         => {
    'Test::More'         =>  0,
    'Graph'              =>  0,
    'Grammar::Formal'    =>  0,
    'Modern::Perl'       =>  0,
    'Moose'              =>  0,
    'List::UtilsBy'      =>  0,
    'List::MoreUtils'    =>  0,
    'List::Util'         =>  0,
    'Storable'           =>  0,
    'Graph::SomeUtils'   =>  0,
  },
  ABSTRACT_FROM     => 'lib/Grammar/Graph.pm',
  AUTHOR            => 'Bjoern Hoehrmann <bjoern@hoehrmann.de>',
  LICENSE           => 'perl',

lib/Grammar/Graph.pm  view on Meta::CPAN

#####################################################################
# Types
#####################################################################
package Grammar::Graph::Types;
use Modern::Perl;
use parent qw/Type::Library/;
use Type::Utils;
use Types::Standard qw/Int/;

declare 'Vertex',
  as Int,
  where { $_ > 0 };

#####################################################################
# Role for non-terminal names
#####################################################################
package Grammar::Graph::Named;
use Modern::Perl;
use Moose::Role;

has 'name' => (
  is       => 'ro',
  required => 1,
  isa      => 'Str'
);

#####################################################################
# Role for coupled vertices
#####################################################################
package Grammar::Graph::Coupled;
use Modern::Perl;
use Moose::Role;

has 'partner' => (
  is       => 'ro',
  required => 1,
  writer   => '_set_partner',
  isa      => Grammar::Graph::Types::Vertex(),
);

#####################################################################
# Start
#####################################################################
package Grammar::Graph::Start;
use Modern::Perl;
use Moose;
extends 'Grammar::Formal::Empty';
with 'Grammar::Graph::Coupled',
     'Grammar::Graph::Named';
     
#####################################################################
# Final
#####################################################################
package Grammar::Graph::Final;
use Modern::Perl;
use Moose;
extends 'Grammar::Formal::Empty';
with 'Grammar::Graph::Coupled',
     'Grammar::Graph::Named';

#####################################################################
# Conditionals
#####################################################################
package Grammar::Graph::Conditional;
use Modern::Perl;
use Moose;

extends qw/Grammar::Formal::Empty/;
with qw/Grammar::Graph::Coupled/;

has 'p1' => (
  is       => 'ro',
  required => 1,
  isa      => Grammar::Graph::Types::Vertex()
);

lib/Grammar/Graph.pm  view on Meta::CPAN

has 'name' => (
  is       => 'ro',
  required => 1,
  isa      => 'Str'
);

#####################################################################
# If (start of conditional)
#####################################################################
package Grammar::Graph::If;
use Modern::Perl;
use Moose;
extends 'Grammar::Graph::Conditional';

#####################################################################
# Fi (end of conditional)
#####################################################################
package Grammar::Graph::Fi;
use Modern::Perl;
use Moose;
extends 'Grammar::Graph::Conditional';

#####################################################################
# Operands
#####################################################################
package Grammar::Graph::Operand;
use Modern::Perl;
use Moose;
extends 'Grammar::Formal::Empty';
with qw/Grammar::Graph::Coupled/;

#####################################################################
# Prelude (character before any other)
#####################################################################
package Grammar::Graph::Prelude;
use Modern::Perl;
use Moose;
extends 'Grammar::Formal::CharClass';
with qw/Grammar::Graph::Coupled/;

has '+spans'  => (
  required => 0,
  default  => sub {
    Set::IntSpan->new([-1])
  },
);

#####################################################################
# Postlude (character after any other)
#####################################################################
package Grammar::Graph::Postlude;
use Modern::Perl;
use Moose;
extends 'Grammar::Formal::CharClass';
with qw/Grammar::Graph::Coupled/;

has '+spans'  => (
  required => 0,
  default  => sub {
    Set::IntSpan->new([-1])
  },
);

#####################################################################
# Grammar::Graph
#####################################################################
package Grammar::Graph;
use 5.012000;
use Modern::Perl;
use Grammar::Formal;
use List::UtilsBy qw/partition_by/;
use List::MoreUtils qw/uniq/;
use List::Util qw/shuffle sum max/;
use Storable qw/freeze thaw/;
use Graph::SomeUtils qw/:all/;
use Graph::Directed;
use Moose;

#####################################################################



( run in 0.556 second using v1.01-cache-2.11-cpan-a5abf4f5562 )