Skip to content

Instantly share code, notes, and snippets.

@rns
rns / bslr.pl
Last active August 27, 2015 21:02
Benchmark sequences vs left recursion
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Marpa::R2;
use Getopt::Long;
use strict;
use diagnostics;
use Marpa::R2;
use Test::More;
my $g = Marpa::R2::Scanless::G->new({ source => \(<<'END_OF_SOURCE') });
lexeme default = inaccessible => discard
$VAR1 = [
'S',
'pair',
[
'S',
'bracketed',
'<',
[
${\$VAR1->[0]},
${\$VAR1->[1]},
@rns
rns / ambig.pl
Created August 19, 2014 08:06 — forked from jeffreykegler/ambig.pl
#!/usr/bin/perl
# Copyright 2014 Jeffrey Kegler
# This file is part of Marpa::R2. Marpa::R2 is free software: you can
# redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# Marpa::R2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@rns
rns / number.pl
Last active August 29, 2015 14:05
use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $g = Marpa::R2::Scanless::G->new( {
bless_package => 'main',
@rns
rns / ast.pl
Last active August 29, 2015 14:05 — forked from jeffreykegler/ast.pl
#!/usr/bin/perl
# Copyright 2013 Jeffrey Kegler
# This file is part of Marpa::R2. Marpa::R2 is free software: you can
# redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# Marpa::R2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@rns
rns / lao.pl
Last active August 29, 2015 14:06
use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $g = Marpa::R2::Scanless::G->new( {
source => \(<<'END_OF_SOURCE'),
@rns
rns / las-span.pl
Last active August 29, 2015 14:06
use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $g = Marpa::R2::Scanless::G->new( {
source => \(<<'END_OF_SOURCE'),
@rns
rns / where.pl
Created September 5, 2014 08:52
use 5.018;
use strictures;
use Marpa::R2 qw();
my $source = <<'END';
:default ::=
action => [values]
bless => ::lhs
lexeme default =
action => [ value ]
use 5.010;
use strict;
use warnings;
use Marpa::R2;
use YAML;
my $g = Marpa::R2::Scanless::G->new( {
source => \(<<'END_OF_SOURCE'),
:default ::= action => [name, value]