MarpaX::Languages::SQL2003::AST - Translate SQL-2003 source to an AST
version 0.005
use strict;
use warnings FATAL => 'all';
use MarpaX::Languages::SQL2003::AST;
#
# Parse SQL
#
my $input = 'select * from myTable;';
my $obj = MarpaX::Languages::SQL2003::AST->new(host => 'C');
my $ast = $obj->parse($input);
my $xml = $obj->parse($input, xml => 1);
This module translates SQL-2003 to an AST.
Instantiate a new object. %opts supported keys are:
- host
-
Target host language. Supported values are: Ada, C, Cobol, Fortran, Mumps, Pascal, PLI. Default value C.
Parse $input and return $self. Accept an optional %opts hash whose keys can be:
- xml
-
If $opts{xml} is a true value, produces the AST as an XML::LibXML::Document object. Default is a false value, meaning that the AST is a composite structure of blessed hash references and array references.
Any other key will be passed as-is to the Marpa's parse() method, i.e. it has to have a meaning to Marpa's recognizer. Typical examples are: trace_terminals => 1, trace_values => 1.
Alias to $self->parse($input, xml => 1, %opts).
Please refer to MarpaX::Languages::SQL2003::AST::Actions for the semantic actions.
Alias to $self->parse($input, xml => 0, %opts).
Please refer to MarpaX::Languages::SQL2003::AST::Actions for the semantic actions.
This module is using a generated Marpa::R2's BNF grammar, based on a manipulation of http://savage.net.au/SQL/sql-2003-2.bnf, the later being in EBNF format. That is, some rules or lexemes in the output may appear as Genxxx or GenLexyyy, showing unfortunately some of the internals of the EBNF to BNF transformation.
MarpaX::Languages::SQL2003::AST::Actions, 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-SQL2003-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-sql2003-ast
git clone git://github.com/jddurand/marpax-languages-sql2003-ast.git
Jean-Damien Durand <[email protected]>
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.