MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5 - ECMAScript-262, Edition 5, grammar
version 0.020
use strict; use warnings FATAL => 'all'; use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5; my $ecma = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5->new(); my $program = $ecma->program();
This modules returns all grammars needed for the ECMAScript 262, Edition 5 grammars written in Marpa BNF, as of http://www.ecma-international.org/publications/standards/Ecma-262.htm. ONLY the Program and JSON grammars provides an AST. The StringNumericLiteral and Pattern grammars, if needed by another engine but a perl executable, will have to be provided expicitely. StringNumericLiteral and Pattern parse tree values presented here are meaningful only for a perl engine.
From a perl engine point of view, there two main notion of numbers: native (i.e. the ones in the math library with which perl was build), and the Math::Big* family. Therefore the parse tree value of the StringNumericLiteral is abstracted to handle both cases.
The Pattern parse tree value provides an anoynmous subroutine to be used directly as a Regexp.prototype.exec call.
Instance a new object. Takes as optional argument a hash that may contain the following key/values:
Reference to hash containing options for MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Template. These options can be:
G1 callback (CODE ref)
G1 callback arguments (ARRAY ref). The g1 callback is called like: &$g1Callback(@{$g1CallbackArgs}, \$rc, $ruleId, $value, $index, $lhs, @rhs), where $value is the AST parse tree value of RHS No $index of this G1 rule number $ruleId, whose full definition is $lhs ::= @rhs. If the callback is defined, this will always be executed first, and it must return a true value putting its eventual result in $rc. Only when it returns true, lexemes are processed.
lexeme callback (CODE ref).
Lexeme callback arguments (ARRAY ref). The lexeme callback is called like: &$lexemeCallback(@{$lexemeCallbackArgs}, \$rc, $name, $ruleId, $value, $index, $lhs, @rhs), where $value is the AST parse tree value of RHS No $index of this G1 rule number $ruleId, whose full definition is $lhs ::= @rhs. The RHS being a lexeme, $name contains the lexeme's name. If the callback is defined, this will always be executed first, and it must return a true value putting its result in $rc, otherwise default behaviour applies: return the lexeme value as-is.
Reference to hash containing options for MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral. These options can be:
Semantic package providing host implementation of a Number.
Returns the program grammar as a hash reference that is
A MarpaX::Languages::ECMAScript::AST::Grammar::Base object
A MarpaX::Languages::ECMAScript::AST::Impl object
Returns the JSON grammar as a hash reference that is
Returns the URI grammar as a hash reference that is
Returns the template associated to this grammar. This is a MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Template object.
Returns the StringNumericLiteral grammar as a hash reference that is
Returns the Pattern grammar as a hash reference that is
Returns the SpacesAny grammar as a hash reference that is
MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral
MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Pattern
MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Template
Jean-Damien Durand <jeandamiendurand@free.fr>
This software is copyright (c) 2013 by Jean-Damien Durand.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install MarpaX::Languages::ECMAScript::AST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MarpaX::Languages::ECMAScript::AST
CPAN shell
perl -MCPAN -e shell install MarpaX::Languages::ECMAScript::AST
For more information on module installation, please visit the detailed CPAN module installation guide.