Skip to content

Instantly share code, notes, and snippets.

use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $g = Marpa::R2::Scanless::G->new( {
source => \(<<'END_OF_SOURCE'),
use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $g = Marpa::R2::Scanless::G->new( {
bless_package => 'main',
#!/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
#!/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
use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $input = <<EOI;
../cpan/lib/dev/file.c(11824) : warning C4820: '__unnamed' : '3' bytes padding added after member 'c'
#!/usr/bin/env perl
use Marpa::R2;
use warnings;
use strict;
my $basic_math_grammar =
Marpa::R2::Scanless::G->new({
action_object => 'BasicMath',
default_action => '::first',
source => \(<<'END_OF_RULES'),
use 5.010;
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent = 0;
$Data::Dumper::Terse = 1;
use Marpa::R2;
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 / Heckendorn.pl
Last active May 14, 2022 13:35
Heckendorn
use 5.010;
use strict;
use warnings;
=pod Almost SLIF Example from http://marvin.cs.uidaho.edu/Teaching/CS445/grammar.html
Here is a tree structure as nested parentheses. For instance (ant) or (cat, bat)
or ((cat), (bat)) or ((cat, bat, dog), ant).
Note the hierarchical handling of each feature.
Note also that when <tree> points up from <thing> to the top of the grammar