Re: Using Marpa::R2::NAIF to clean up Context-Free Grammars

2014-09-26 Thread Ruslan Shvedov
On Sat, Sep 27, 2014 at 12:54 AM, Christopher Layne wrote: > Couldn't you just not use unproductive_ok and inaccessible_ok? > Yes I could, and tried that at first, but that issued warnings I hated silencing. > > On Sep 26, 2014, at 0930 PT, Ruslan Shvedov > wrote: > > > Unproductive and unacces

Re: Using Marpa::R2::NAIF to clean up Context-Free Grammars

2014-09-26 Thread Christopher Layne
Couldn't you just not use unproductive_ok and inaccessible_ok? On Sep 26, 2014, at 0930 PT, Ruslan Shvedov wrote: > Unproductive and unaccessible rules can be removed from a grammar easily > using code like this: > > # cleanup the grammar using Marpa NAIF > my $grammar = Marpa::R2::Grammar->ne

Using Marpa::R2::NAIF to clean up Context-Free Grammars

2014-09-26 Thread Ruslan Shvedov
Unproductive and unaccessible rules can be removed from a grammar easily using code like this: # cleanup the grammar using Marpa NAIF my $grammar = Marpa::R2::Grammar->new({ start => ..., rules => ..., unproductive_ok => 1, inaccessible_ok => 1, }); $grammar->precompute(); my $rules = $gramm