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.


new($class, %opts)

Instantiate a new object. %opts supported keys are:


Target host language. Supported values are: Ada, C, Cobol, Fortran, Mumps, Pascal, PLI. Default value C.

parse($self, $input, %opts)

Parse $input and return $self. Accept an optional %opts hash whose keys can be:


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.

asXML($self, $input, %opts)

Alias to $self->parse($input, xml => 1, %opts).

Please refer to MarpaX::Languages::SQL2003::AST::Actions for the semantic actions.

asBlessed($self, $input, %opts)

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, 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


Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

  git clone git://


Jean-Damien Durand <>


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.