NAME
    MarpaX::Languages::C::AST - Translate a C source to an AST

VERSION
    version 0.08

SYNOPSIS
        use strict;
        use warnings FATAL => 'all';
        use MarpaX::Languages::C::AST;
        use Log::Log4perl qw/:easy/;
        use Log::Any::Adapter;
        use Log::Any qw/$log/;
        use Data::Dumper;
        #
        # Init log
        #
        our $defaultLog4perlConf = '
        log4perl.rootLogger              = WARN, Screen
        log4perl.appender.Screen         = Log::Log4perl::Appender::Screen
        log4perl.appender.Screen.stderr  = 0
        log4perl.appender.Screen.layout  = PatternLayout
        log4perl.appender.Screen.layout.ConversionPattern = %d %-5p %6P %m{chomp}%n
        ';
        Log::Log4perl::init(\$defaultLog4perlConf);
        Log::Any::Adapter->set('Log4perl');
        #
        # Parse C
        #
        my $cSourceCode = '
        typedef struct s1_ {int i1;} x1, y1;
        struct x1 {x1 i2;};
        x1 x;
        ';
        my $cAstObject = MarpaX::Languages::C::AST->new();
        print Dumper($cAstObject->parse(\$cSourceCode));

DESCRIPTION
    This modules translates a C source into an AST tree. The AST consist of
    blessed objects that map exactly to the C grammar in use. If you want to
    enable logging, be aware that this module is a Log::Any thingy.

    Please note that this module just *translates* a C source, it does *not*
    check for its correctness, i.e. the numerous grammar constraints built
    on top on the C grammar are not implemented, for example constraint on
    the number of storage class specifiers, uniqueness of labeled statements
    within a function, etc.. This is left to a compiler, which is not the
    goal here. So, to state things clearly, this module is addressing the
    *ambiguities* of the grammar itself, i.e. the dangling else, the
    typedef/enum/identifier. And produces an AST of the parse tree value.

SUBROUTINES/METHODS
  new($class, $grammarName)
    Instantiate a new object. Takes as parameter an optional base name of a
    grammar. Default is 'ISO-ANSI-C-2011'.

  parse($self, $referenceToSourceCodep, $optionalArrayOfValuesb)
    Do the parsing and return the blessed value. Takes as first parameter
    the reference to a C source code. Takes as optional second parameter a
    flag saying if the return value should be an array of all values or not.
    If this flag is false, the module will croak if there more than one
    parse tree value.

SUPPORT
  Bugs / Feature Requests
    Please report any bugs or feature requests through the issue tracker at
    <https://rt.cpan.org/Public/Dist/Display.html?Name=MarpaX-Languages-C-AS
    T>. 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.

    <https://github.com/jddurand/marpax-languages-c-ast>

      git clone git://github.com/jddurand/marpax-languages-c-ast.git

AUTHOR
    Jean-Damien Durand <jeandamiendurand@free.fr>

COPYRIGHT AND LICENSE
    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.

