MarpaX::Demo::SampleScripts - A collection of scripts using Marpa::R2
MarpaX::Demo::SampleScripts
See scripts/*.pl.
MarpaX::Demo::SampleScripts demonstrates various grammars and various ways to write and test scripts.
The whole point of this module is in scripts/*.pl.
Install MarpaX::Demo::SampleScripts as you would for any Perl module:
Perl
Run:
cpanm MarpaX::Demo::SampleScripts
or run:
sudo cpan MarpaX::Demo::SampleScripts
or unpack the distro, and then either:
perl Build.PL ./Build ./Build test sudo ./Build install
or:
perl Makefile.PL make (or dmake or nmake) make test make install
new() is called as my($parser) = MarpaX::Demo::SampleScripts -> new(k1 => v1, k2 => v2, ...).
new()
my($parser) = MarpaX::Demo::SampleScripts -> new(k1 => v1, k2 => v2, ...)
It returns a new object of type MarpaX::Demo::SampleScripts.
Key-value pairs accepted in the parameter list:
(None).
This method does nothing, and return 0 for success.
Many of these scripts are gists, i.e. from https://gist.github.com/. You can always go there are search for some unique text within the script, to see if there are other versions, or commentary available.
All these scripts are in the scripts/ directory.
A grammar for the Velocity language.
Display Marpa's view of the structure of a grammar.
Process defective HTML.
Match nested parantheses, i.e. the '(' and ')' pair.
This sophisticated example checks files for matching brackets: (){}[].
Or, it can be run (self-tested) with the '--test' option'.
The new rejection events are used, along with the Ruby Slippers, meaning it requires Marpa::R2 V 2.098000.
This program uses the method of adding known tokens (my $suffix = '(){}[]';) to the end of the input string so Marpa can be told to search just that part of the string when the logic dictates that a Ruby Slippers token (bracket) is to be passed to Marpa to satisfy the grammar. It's put at the end so that it does not interfere with line and column counts in the original input string.
Handle parts of the grammar as strings, and interpolate various things into those strings, before using them to build the final grammar.
Handle nested, double-quoted, strings.
Handle strings quoted with various characters, and with escaped characters in there too.
Uses a grammar with pauses to handle various types of quoted strings, with manual scanning.
See quoted.strings.05.pl for getting Marpa to handling the scanning of HTML.
Handles HTML.
All these scripts are in the examples/ directory.
Show how, during an action sub, another parse can be done using the output of the parse which triggered the action. The inner parse uses the same grammar as the outer parse.
Contains both ambiguous and un-ambiguous grammars.
Uses MarpaX::ASF::PFG, which is not on MetaCPAN.
Parse multiple heredocs.
Processes HTML.
Uses HTML::WikiConverter, which won't install without patches, and which the author apparently refuses to fix.
Yes. See scripts/quoted.strings.05.pl.
The file Changes was converted into Changelog.ini by Module::Metadata::Changes.
Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
Email the author, or log a bug on RT:
https://rt.cpan.org/Public/Dist/Display.html?Name=MarpaX::Demo::SampleScripts.
MarpaX::Demo::SampleScripts was written by Ron Savage <ron@savage.net.au> in 2014.
Marpa's homepage: <http://savage.net.au/Marpa.html>.
My homepage: http://savage.net.au/.
Australian copyright (c) 2014, Ron Savage.
All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Artistic License 2.0, a copy of which is available at: http://www.opensource.org/licenses/index.html
To install MarpaX::Demo::SampleScripts, copy and paste the appropriate command in to your terminal.
cpanm
CPAN shell
perl -MCPAN -e shell install MarpaX::Demo::SampleScripts
For more information on module installation, please visit the detailed CPAN module installation guide.