MarpaX::ESLIF::Grammar::Properties - ESLIF Grammar Properties
version 2.0.23
use MarpaX::ESLIF; my $eslif = MarpaX::ESLIF->new(); my $data = do { local $/; <DATA> }; my $eslifGrammar = MarpaX::ESLIF::Grammar->new($eslif, $data); my $grammarProperties = $eslifGrammar->currentProperties; my $grammarPropertiesByLevel = $eslifGrammar->propertiesByLevel(0); __DATA__ # # This is an example of a calculator grammar # :start ::= Expression :default ::= action => do_op symbol-action => do_symbol free-action => do_free # Supported but useless :desc ::= 'Calculator' :discard ::= whitespaces event => discard_whitespaces$ :discard ::= comment event => discard_comment$ event ^Number = predicted Number event Number$ = completed Number Number ::= NUMBER action => ::shift event Expression$ = completed Expression event ^Expression = predicted Expression Expression ::= Number action => do_int | '(' Expression ')' assoc => group action => ::copy[1] || Expression '**' Expression assoc => right || Expression '*' Expression | Expression '/' Expression || Expression '+' Expression | Expression '-' Expression whitespaces ::= WHITESPACES comment ::= /(?:(?:(?:\/\/)(?:[^\n]*)(?:\n|\z))|(?:(?:\/\*)(?:(?:[^\*]+|\*(?!\/))*)(?:\*\/)))/u :lexeme ::= NUMBER pause => before event => ^NUMBER :lexeme ::= NUMBER pause => after event => NUMBER$ :desc ~ 'Calculator Tokens' NUMBER ~ /[\d]+/ name => 'NUMBER Lexeme' WHITESPACES ~ [\s]+ name => 'WHITESPACES Lexeme'
ESLIF Grammar Properties.
Calls to grammar's currentProperties() or propertiesByLevel() methods outputs an instance of this class.
Creation of an ESLIFGrammarProperties instance, noted $self afterwards. %args is a hash that should contain:
$self
%args
Grammar level
Maximum grammar level
Grammar description
Grammar is in LATM (Longest Accepted Token Mode) ?
Grammar default symbol action
Grammar default rule action
Grammar default free action
Start symbol Id
Discard symbol Id
Symbol Ids (array reference)
Rule Ids (array reference)
Returns grammar's level
Returns maximum grammar's level
Returns grammar's description
Returns a boolean that indicates if this grammar is in the LATM (Longest Acceptable Token Mode) or not
Alias to isLatm()
Returns grammar's default symbol action, never null
Returns grammar's default rule action, can be null
Returns grammar's default free action, never null and always ":defaultFreeActions" (hardcoded in the JNI interface)
Returns grammar's start symbol id, always >= 0
Returns grammar's discard symbol id, < 0 if none.
Returns a reference to a list of symbol identifiers
Returns a reference to a list of rule identifiers
Jean-Damien Durand <jeandamiendurand@free.fr>
This software is copyright (c) 2017 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::ESLIF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MarpaX::ESLIF
CPAN shell
perl -MCPAN -e shell install MarpaX::ESLIF
For more information on module installation, please visit the detailed CPAN module installation guide.