Marpa::R3::Changes - Differences between Marpa::R2 and Marpa::R3
This document describes the incompatible differences between Marpa::R2 and Marpa::R3. (Differences that do not give rise to incompatibility are outside of its scope.) It is intended for readers already familiar with Marpa::R2, who are writing new applications for Marpa::R3, and for readers migrating Marpa::XS applications and tools to Marpa::R3.
The Stuifzand interface (PSIF), and its documentation, have been removed. Important in the development of Marpa, it now has little or now usage.
The THIF is subject to major change, or outright removal, without further notice.
The NAIF is an older interface using hashes of named variables, instead of a DSL. It is now severely deprecated. Expect it to be broken or removed shortly.
The actions, action_object, default_action and default_empty_action named arguments of Marpa::R2::Scanless::G named arguments have been removed in Marpa::R3.
actions
action_object
default_action
default_empty_action
Several new methods have been added as accessors for L0 grammars:
Marpa::R2::Scanless::G::l0_symbol_dsl_form()
Marpa::R2::Scanless::G::l0_rule_expand()
Marpa::R2::Scanless::G::l0_rule_ids()
Marpa::R2::Scanless::G::l0_rule_show()
Marpa::R2::Scanless::G::l0_symbol_display_form()
Marpa::R2::Scanless::G::l0_symbol_ids()
Marpa::R2::Scanless::G::l0_symbol_name()
Marpa::R2::Scanless::G::l0_show_rules()
Marpa::R2::Scanless::G::l0_show_symbols()
The Marpa::R2::Scanless::G::g0_rule() method, the Marpa::R2::Scanless::G::g0_rule_ids() method, the Marpa::R2::Scanless::G::g1_rule_ids() method, and the Marpa::R2::Scanless::G::rule() method, discouraged in Marpa::R2, have been eliminated in Marpa::R3.
Marpa::R2::Scanless::G::g0_rule()
Marpa::R2::Scanless::G::g0_rule_ids()
Marpa::R2::Scanless::G::g1_rule_ids()
Marpa::R2::Scanless::G::rule()
The Marpa::R2::Scanless::G::symbol_description() method has been removed.
Marpa::R2::Scanless::G::symbol_description()
The following methods have been changed:
Marpa::R2::Scanless::G::symbol_dsl_form()
Marpa::R2::Scanless::G::rule_expand()
Marpa::R2::Scanless::G::rule_ids()
Marpa::R2::Scanless::G::rule_show()
Marpa::R2::Scanless::G::symbol_display_form()
Marpa::R2::Scanless::G::symbol_ids()
Marpa::R2::Scanless::G::symbol_name()
Marpa::R2::Scanless::G::show_rules()
Marpa::R2::Scanless::G::show_symbols()
They no longer take an argument indicating the subgrammar -- instead they always return result for the G1 grammar. New methods have been added to return results for the L0 grammar. For these, see "New Marpa::R3::Scanless::G methods".
For historical reasons, the methods dealing with input and G1 parse location in Marpa::R2 often had unhelpful or misleading names. In Marpa::R3 an attempt is being made to name methods dealing with G1 and input parse location consistently, and to ensure that the G1 variants have g1 somewhere in their name. Accordingly, $slr-substring()> has been renamed $slr-g1_literal()>; and $slr->current_g1_location() is now $slr->g1_pos().
g1
$slr-
The Marpa::R2::Scanless::R::event() method, Marpa::R2::Scanless::R::last_completed_range() method, Marpa::R2::Scanless::R::pause_lexeme() method, and the Marpa::R2::Scanless::R::range_to_string() method, discouraged in Marpa::R2, have been eliminated in Marpa::R3.
Marpa::R2::Scanless::R::event()
Marpa::R2::Scanless::R::last_completed_range()
Marpa::R2::Scanless::R::pause_lexeme()
Marpa::R2::Scanless::R::range_to_string()
In Marpa::R2, if the semantics package has a new() method, that method was used as the constructor of the per-parse object. In Marpa::R3, there is no per-parse constructor.
new()
In Marpa::R2, if the c<semantics_package> named argument was not used and the per-parse argument was blessed, then the package into which the per-parse argument was blessed became the semantics package. In Marpa::R3, the per-parse argument has no effect on the semantics package.
Under Marpa::R2, the semantic closure received a varying number of arguments, depending on circumstances. Under Marpa::R3, the semantic closure always receives exactly 2 arguments. The first argument is the per-parse object. The second argument is a reference to an array containing the values of the child nodes, in lexical order. If there were no child nodes visible to the semantics, then the second argument is an empty array.
Marpa::R3 is Copyright (C) 2016, Jeffrey Kegler. This module is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.1. For more details, see the full text of the licenses in the directory LICENSES. This program 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.
To install Marpa::R3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Marpa::R3
CPAN shell
perl -MCPAN -e shell install Marpa::R3
For more information on module installation, please visit the detailed CPAN module installation guide.