MarpaX::Languages::IDL::AST - Translate an IDL source to an AST
version 0.007
use MarpaX::Languages::IDL::AST; my $idlPath = 'source.idl'; my $ast = MarpaX::Languages::IDL::AST->new()->parse($idlPath)->validate();
Instantiate a new object. Returns a reference to it, denoted $self hereafter.
Parse the IDL and produce an AST out of it, then a meta-AST that is more useful representation for further processing. Takes as parameters:
A required IDL pathname.
An optional reference to a hash containing Marpa::R2::Scanless::R() parameters, except the grammar and semantics_package options.
The AST is an exact representation of the parse tree value of the IDL grammar contained in this package, except:
Original grammar rule is:
<scopedName> ::= <identifier> | '::' <identifier> | <scopedName> '::' <identifier>
and has been rewriten to:
<scopedName> ::= <identifier>+ separator => <coloncolon>
A dedicated action rule will concatenate all identifiers into a single string, giving the impression that scopedName is a token (accurate terminology is a lexeme). I.e. the scopedName value in the AST is in the form:
bless([start,totalLength,concatenatedValue], 'IDL::AST::scopedName')
alike the identifier.
This method returns $self.
Returns the latest AST produced by $self->parse().
Returns the latest output produced by $self->generate().
Generate files for the given AST $ast.
AST as produced by the method $self->parse(). Default to $self->ast().
Template-Toolkit template name. Default to 'perl5.tt2', available in this distribution.
Hash reference of options specific to target $target.
This module provide and manage an AST of an IDL file, as per OMG's IDL 3.5 grammar specification.
IDL version is 3.5 as of OMG IDL3.5 Specification.
This specification imposes input to come from a filename, with suffix '.idl'.
Any preprocessing feature is ignored, and eventual multi-line proprocessing directives are likely to cause failure. Since the most expected preprocessing tokens are #include, #ifdef, and al., the user is expected to have already run a preprocessor before using this package.
Marpa::R2
Please report any bugs or feature requests through the issue tracker at https://rt.cpan.org/Public/Dist/Display.html?Name=MarpaX-Languages-IDL-AST. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/jddurand/marpax-languages-idl-ast
git clone git://github.com/jddurand/marpax-languages-idl-ast.git
Jean-Damien Durand <jeandamiendurand@free.fr>
This software is copyright (c) 2014 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::IDL::AST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MarpaX::Languages::IDL::AST
CPAN shell
perl -MCPAN -e shell install MarpaX::Languages::IDL::AST
For more information on module installation, please visit the detailed CPAN module installation guide.