Skip to content

Instantly share code, notes, and snippets.

@rns
rns / timeflies-alternative-only.pl
Created September 9, 2012 07:30
timeflies.t done using only "alternative"
#!/usr/bin/perl
# Copyright 2012 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 / timeflies-read-and-multisymbols.t
Created September 9, 2012 07:56
timeflies.t done using only "read"
#!/usr/bin/perl
# Copyright 2012 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 / sl_timeflies_sort_parses.t
Created November 28, 2013 06:50
cross-sentence disambiguation by naive parse sorting
#!/usr/bin/perl
# Copyright 2013 Jeffrey Kegler, 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
# Lesser General Public License for more details.
@rns
rns / sl_timeflies.t
Created November 28, 2013 06:55
timeflies.t converted to SLIF
#!/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 / ambiguity_show() vs. asf_to_basic_tree and array_display()
Last active December 29, 2015 15:08
cross-sentence disambiguation with ASF's — first cut
# ambiguities via ASF's ambiguities_show()
Ambiguous symch at Glade=7, Symbol=<sentence>:
The ambiguity is from line 1, column 1 to line 1, column 25
Text is: Time flies like an arrow.
There are 2 symches
Symch 0 is a rule: sentence ::= subject verb adjunct period
Symch 1 is a rule: sentence ::= subject verb object period
Ambiguous symch at Glade=5, Symbol=<sentence>:
The ambiguity is from line 3, column 1 to line 3, column 26
Text is: Fruit flies like a banana.
@rns
rns / parse_results
Last active December 29, 2015 15:08
Parses of 'Time flies like an arrow. Time flies fast. Fruit flies like a banana. Fruit flies spoil a banana.' with https://gist.github.com/rns/7688187
# s = subject, v = verb, o = object, adju = adjunct
# adje = adjective, adv = avderb, n = noun, art = article
sva(s(n(Time));v(flies);adju(pr(like);o(art(an);n(arrow))))
sva(s(n(Time));v(flies);adju(adv(fast)))
svo(s(adje(Fruit);n(flies));v(like);o(art(a);n(banana)))
svo(s(adje(Fruit);n(flies));v(spoil);o(art(a);n(banana)))
svo(s(adje(Time);n(flies));v(like);o(art(an);n(arrow)))
sva(s(n(Time));v(flies);adju(adv(fast)))
@rns
rns / ambiguities
Created November 28, 2013 07:19
ambiguities shown with ASF
# ambiguities via ASF's ambiguities_show()
Ambiguous symch at Glade=7, Symbol=<sentence>:
The ambiguity is from line 1, column 1 to line 1, column 21
Text is: Time flies like an ar
There are 2 symches
Symch 0 is a rule: sentence ::= subject verb adjunct period
Symch 1 is a rule: sentence ::= subject verb object period
Ambiguous symch at Glade=5, Symbol=<sentence>:
The ambiguity is from line 2, column 10 to line 3, column 14
Text is: s fast.\nFruit flies l
@rns
rns / gist:8042426
Last active December 31, 2015 20:49
wrap C<X> as L<C<X>> if X is =head? X
#!/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 / symbol_dsl_form.t
Created January 11, 2014 15:54
Show symbol_dsl_form()'s of all symbols_ids()
use 5.010;
use strict;
use warnings;
use Data::Dumper;
use Marpa::R2;
my $g = Marpa::R2::Scanless::G->new( {
bless_package => 'main',
C:\.cpan\build\Marpa-R2-2.079_008>vsvars32.bat && mp18 Build --XS-debug test
Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)
Using Config::AutoConf
Writing version files
Building Marpa-R2
Checking inline... no
Checking __inline__... no