[svn:parrot] r45957 - in trunk: . compilers/ncigen compilers/ncigen/config/makefiles compilers/ncigen/lib/Parrot/Test compilers/ncigen/src compilers/ncigen/src/builtins compilers/ncigen/src/parser compilers/ncigen/t compilers/ncigen/t/NCIGENAST config/gen config/gen/makefiles

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Apr 24 02:42:03 UTC 2010


Author: bacek
Date: Sat Apr 24 02:42:02 2010
New Revision: 45957
URL: https://trac.parrot.org/parrot/changeset/45957

Log:
Remove compilers/ncigen. Closing TT#1573.

Deleted:
   trunk/compilers/ncigen/MAINTAINER
   trunk/compilers/ncigen/NCIGEN.TODO
   trunk/compilers/ncigen/NCIGENP6.pm
   trunk/compilers/ncigen/README
   trunk/compilers/ncigen/config/makefiles/ncigen.in
   trunk/compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm
   trunk/compilers/ncigen/ncigen.pir
   trunk/compilers/ncigen/ncigen.pl
   trunk/compilers/ncigen/src/NCIGENAST.pir
   trunk/compilers/ncigen/src/NCIPIR.pir
   trunk/compilers/ncigen/src/builtins/say.pir
   trunk/compilers/ncigen/src/parser/actions.pm
   trunk/compilers/ncigen/src/parser/grammar.pg
   trunk/compilers/ncigen/t/NCIGENAST/struct_00.t
   trunk/compilers/ncigen/t/NCIGENAST/typedef_00.t
   trunk/compilers/ncigen/t/harness
   trunk/compilers/ncigen/t/parse_00.t
   trunk/compilers/ncigen/t/parse_01.t
   trunk/compilers/ncigen/t/parse_02.t
Modified:
   trunk/MANIFEST
   trunk/config/gen/makefiles.pm
   trunk/config/gen/makefiles/root.in

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Sat Apr 24 02:38:23 2010	(r45956)
+++ trunk/MANIFEST	Sat Apr 24 02:42:02 2010	(r45957)
@@ -66,25 +66,6 @@
 compilers/json/JSON/grammar.pg                              [json]
 compilers/json/JSON/pge2pir.tg                              [json]
 compilers/json/Rules.mak                                    [json]
-compilers/ncigen/MAINTAINER                                 [ncigen]
-compilers/ncigen/NCIGEN.TODO                                [ncigen]
-compilers/ncigen/NCIGENP6.pm                                [ncigen]
-compilers/ncigen/README                                     []doc
-compilers/ncigen/config/makefiles/ncigen.in                 [ncigen]
-compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm               [ncigen]
-compilers/ncigen/ncigen.pir                                 [ncigen]
-compilers/ncigen/ncigen.pl                                  [ncigen]
-compilers/ncigen/src/NCIGENAST.pir                          [ncigen]
-compilers/ncigen/src/NCIPIR.pir                             [ncigen]
-compilers/ncigen/src/builtins/say.pir                       [ncigen]
-compilers/ncigen/src/parser/actions.pm                      [ncigen]
-compilers/ncigen/src/parser/grammar.pg                      [ncigen]
-compilers/ncigen/t/NCIGENAST/struct_00.t                    [test]
-compilers/ncigen/t/NCIGENAST/typedef_00.t                   [test]
-compilers/ncigen/t/harness                                  [test]
-compilers/ncigen/t/parse_00.t                               [test]
-compilers/ncigen/t/parse_01.t                               [test]
-compilers/ncigen/t/parse_02.t                               [test]
 compilers/pct/Defines.mak                                   [pct]
 compilers/pct/PCT.pir                                       [pct]
 compilers/pct/README.pod                                    []doc

Deleted: trunk/compilers/ncigen/MAINTAINER
==============================================================================
--- trunk/compilers/ncigen/MAINTAINER	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,4 +0,0 @@
-# $Id$
-
-N: Kevin Tew
-E: kevintew at tewk.com

Deleted: trunk/compilers/ncigen/NCIGEN.TODO
==============================================================================
--- trunk/compilers/ncigen/NCIGEN.TODO	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,6 +0,0 @@
-Add option to generate dlfuncs for certain h files not all includes.
-*** Allow typedefs and structs with the same name in the symbol table.
-Generate ManagedStructs definitions for structs and typedefs.
-Generate parrot_builtin_type entries in the AST such as INT NUM STR o PMC
-Add -I include support to ncigen.pl
-Convert ncigen.pl to ncigen.pir

Deleted: trunk/compilers/ncigen/NCIGENP6.pm
==============================================================================
--- trunk/compilers/ncigen/NCIGENP6.pm	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,147 +0,0 @@
-#!/home/tewk/srcs/parrot/perl6
-
-# $Id$
-# Copyright (C) 2008, Parrot Foundation.
-
-use v6;
-class NCIGENAST::FuncDecl {
-}
-
-evalfile('./ncigen.pbc', lang => 'Parrot');
-
-sub parse_ast($fn) {
-    my $pp_fn = mktempfile('ptemp');
-
-    run("gcc -x c -E $fn > $pp_fn");
-    my $compiler = compreg('NCIGEN');
-    my $match = $compiler.parse(slurp($pp_fn));
-    unlink $pp_fn;
-    $match.ast;
-}
-
-sub compreg {
-    my $a = q:PIR { %r = compreg 'NCIGEN' };
-    return $a;
-}
-
-sub mktempfile($prefix) {
-    sub nonce() { ".{$*PID}." ~ int 1000.rand }
-    $prefix ~ nonce;
-}
-
-sub gen_preamble($nsname, $libname) {
-    my $fmt = ".namespace ['$nsname']\n";
-    $fmt ~= ".sub __load_lib_dlfunc_init__ :anon :init :load\n";
-
-    if $libname {
-        $fmt ~= "loadlib \$P1, '$libname'\nif \$P1 goto has_lib\n";
-    }
-    else {
-        $fmt ~= "\$P1 = null\ngoto has_lib\n";
-    }
-
-    $fmt ~=
-        qq{{\$P2 = new 'Exception'
-\$P2[0] = 'error loading $libname - loadlib failed'
-throw \$P2
-has_lib:
-}};
-
-    return $fmt;
-}
-
-sub gen_postamble() {
-    return ".end\n";
-}
-
-sub dump_node($node) {
-    say "====================================================";
-    say $node.perl;
-    for ($node.list) -> $x {
-        say $x.perl;
-    }
-}
-
-=begin
-multi sub pir($node) {
-    say $node.WHAT;
-    return  pir_children($node);
-}
-=end
-
-#multi sub pir(NCIGENAST::TypeDef $node) { return ""; }
-#multi sub pir(NCIGENAST::VarDecl $node) { return ""; }
-multi sub pir(NCIGENAST::FuncDecl $node) {
-## return type
-    my $type = param_to_code($node, 1);
-
-##  get list of arguments to operation
-    for ($node.list()) -> $x {
-        $type ~= param_to_code($x);
-    }
-    return ($node.name, $type, $node.source());
-}
-
-sub format_func_decl($pirname, $cname, $type) {
-    return qq{{dlfunc \$P2, \$P1, '$cname', '$type'
-store_global '$pirname', \$P2}};
-}
-
-sub param_to_code($node, $returncode = 0) {
-    my $pt = $node.'primitive_type'();
-
-    if ($node.pointer()) {
-        if ($node.pointer_cnt() > 1 ) { return "V"; } #out params
-        given $pt {
-          when 'void' {
-            if ($returncode) { return "p"; } #probably should be "V"
-            else { return "p"; }
-          }
-          when 'int'    { return "V"; }
-          when 'long'   { return "V"; }
-          when 'char'   { return "t"; }
-          when 'short'  { return "V"; }
-          when 'double' { return "V"; }
-          when 'floag'  { return "V"; }
-          default {
-=begin
-            say "ERROR";
-            say $node.perl;
-            say "what is this";
-=end
-              return "p";
-          }
-        }
-    }
-    else {
-        given $pt {
-            when 'void' {
-                if ($returncode) { return ""; } # void return code
-                else { return "v"; }
-            }
-            when 'int'      { return "i"; }
-            when 'long'     { return "l"; }
-            when 'char'     { return "c"; }
-            when 'short'    { return "s"; }
-            when 'double'   { return "d"; }
-            when 'floag'    { return "f"; }
-            default         { return "p"; }
-        }
-    }
-}
-
-sub pir_children($node) {
-    my $code = "";
-    for ($node.kv) -> $k, $v {
-        $code ~= pir($v);
-    }
-    return $code;
-}
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab ft=perl6 shiftwidth=2
-
-

Deleted: trunk/compilers/ncigen/README
==============================================================================
--- trunk/compilers/ncigen/README	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,9 +0,0 @@
-./nci_gen.pl is currently written to run on Linux, feel free to add portability if you wish
-
-./nci_gen.pl also requires the perl module IPC::Run3
-
-EXAMPLES:
-perl ./nci_gen.pl postgres/spi.h              - PARSE SUCCESSFUL
-perl ./nci_gen.pl /usr/include/sqlite3.h      - PARSE SUCCESSFUL
-perl ./nci_gen.pl /usr/include/X11/Xlib.h     - PARSE SUCCESSFUL
-perl ./nci_gen.pl /usr/include/mysql/mysql.h  - PARSE SUCCESSFUL

Deleted: trunk/compilers/ncigen/config/makefiles/ncigen.in
==============================================================================
--- trunk/compilers/ncigen/config/makefiles/ncigen.in	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,115 +0,0 @@
-# Copyright (C) 2008-2009, Parrot Foundation.
-## $Id$
-
-## arguments we want to run parrot with
-PARROT_ARGS =
-
-## configuration settings
-BUILD_DIR     = @build_dir@
-LOAD_EXT      = @load_ext@
-O             = @o@
-
-## Setup some commands
-LN_S          = @lns@
-PERL          = @perl@
-RM_RF         = @rm_rf@
-CP            = @cp@
-PARROT        = ../../parrot at exe@
-CAT           = @cat@
-RECONFIGURE   = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
-
-## places to look for things
-PARROT_DYNEXT = $(BUILD_DIR)/runtime/parrot/dynext
-PGE_LIBRARY   = $(BUILD_DIR)/runtime/parrot/library/PGE
-PERL6GRAMMAR  = $(PGE_LIBRARY)/Perl6Grammar.pbc
-NQP           = $(BUILD_DIR)/compilers/nqp/nqp.pbc
-PCT           = $(BUILD_DIR)/runtime/parrot/library/PCT.pbc
-
-PMC_DIR       = src/pmc
-
-all: ncigen.pbc
-
-SOURCES = ncigen.pir \
-  src/gen_grammar.pir \
-  src/gen_actions.pir \
-  src/gen_builtins.pir \
-  src/NCIGENAST.pir \
-  src/NCIPIR.pir
-
-BUILTINS_PIR = \
-  src/builtins/say.pir \
-
-# PMCS = c
-# PMC_SOURCES = $(PMC_DIR)/c.pmc
-
-# the default target
-ncigen.pbc: $(PARROT) $(SOURCES)
-	$(PARROT) $(PARROT_ARGS) -o ncigen.pbc ncigen.pir
-
-src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg
-	$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
-	    --output=src/gen_grammar.pir \
-	    src/parser/grammar.pg
-
-src/gen_actions.pir: $(NQP) $(PCT) src/parser/actions.pm
-	$(PARROT) $(PARROT_ARGS) $(NQP) --output=src/gen_actions.pir \
-	    --target=pir src/parser/actions.pm
-
-src/gen_builtins.pir: $(BUILTINS_PIR)
-	$(CAT) $(BUILTINS_PIR) >src/gen_builtins.pir
-
-# This is a listing of all targets, that are meant to be called by users
-help:
-	@echo ""
-	@echo "Following targets are available for the user:"
-	@echo ""
-	@echo "  all:               ncigen.pbc"
-	@echo "                     This is the default."
-	@echo "Testing:"
-	@echo "  test:              Run the test suite."
-	@echo "  testclean:         Clean up test results."
-	@echo ""
-	@echo "Cleaning:"
-	@echo "  clean:             Basic cleaning up."
-	@echo "  realclean:         Removes also files generated by 'Configure.pl'"
-	@echo "  distclean:         Removes also anything built, in theory"
-	@echo ""
-	@echo "Misc:"
-	@echo "  help:              Print this help message."
-	@echo ""
-
-test: all
-	$(PERL) t/harness
-
-# this target has nothing to do
-testclean:
-
-CLEANUPS = \
-  ncigen.pbc \
-  src/gen_grammar.pir \
-  src/gen_actions.pir \
-  src/gen_builtins.pir \
-  $(PMC_DIR)/*.h \
-  $(PMC_DIR)/*.c \
-  $(PMC_DIR)/*.dump \
-  $(PMC_DIR)/*$(O) \
-  $(PMC_DIR)/*$(LOAD_EXT) \
-  $(PMC_DIR)/*.exp \
-  $(PMC_DIR)/*.ilk \
-  $(PMC_DIR)/*.manifest \
-  $(PMC_DIR)/*.pdb \
-  $(PMC_DIR)/*.lib \
-
-
-clean:
-	$(RM_RF) $(CLEANUPS)
-
-realclean: clean
-	$(RM_RF) Makefile
-
-distclean: realclean
-
-# Local variables:
-#   mode: makefile
-# End:
-# vim: ft=make:

Deleted: trunk/compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm
==============================================================================
--- trunk/compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,167 +0,0 @@
-# $Id$
-# Copyright (C) 2006-2008, Parrot Foundation.
-
-package Parrot::Test::NCIGENAST;
-
-
-use strict;
-use warnings;
-
-use Cwd;
-use File::Spec;
-use File::Basename;
-use Parrot::Test;
-use Data::Dumper;
-
-use Parrot::Config;
-
-require Exporter;
-require Test::Builder;
-require Test::More;
-
-our @EXPORT = qw( ast parse plan skip like istypedef ispointer decl_ident_is type_is is_builtin parse_failure parse_success contains);
-our @EXPORT_OK = qw();
-
-use base qw( Exporter );
-
-# Memoize functions with a fixed output
-# Memoize::memoize('path_to_parrot');
-#
-# # Tell parrot it's being tested--disables searching of installed libraries.
-# # (see Parrot_get_runtime_prefix in src/library.c).
-# $ENV{PARROT_TEST} = 1 unless defined $ENV{PARROT_TEST};
-#
-my $builder = Test::Builder->new();
-
-our $ME = new();
-$ME->{builder}        = $builder;
-$ME->{path_to_parrot} = Parrot::Test::path_to_parrot();
-$ME->{parrot}         = File::Spec->join( $ME->{path_to_parrot}, 'parrot' . $PConfig{exe} );
-our $results;
-
-
-sub import {
-    my ( $class, $plan, @args ) = @_;
-
-    $builder->plan( $plan, @args );
-
-    __PACKAGE__->export_to_level( 1, __PACKAGE__ );
-}
-
-*plan = \&Test::More::plan;
-*skip = \&Test::More::skip;
-
-=head1 Parrot::Test::C99
-
-Provide language specific testing routines here...
-
-This is currently alarmingly similar to the generated subs in Parrot::Test.
-Perhaps someone can do a better job of delegation here.
-
-=cut
-
-sub new {
-    return bless {};
-}
-
-sub ast {
-  my ( $code ) = @_;
-  $results = $ME->ncigenit($code, '--target=nci_ast');
-}
-
-sub parse {
-  my ( $code ) = @_;
-  $results = $ME->ncigenit($code, '--target=parse');
-}
-
-sub like {
-    return $ME->testit('like', @$results, @_);
-}
-
-sub istypedef {
-  return like( qr/NCIGENAST;TypeDef/, @_);
-}
-sub ispointer {
-  return like( qr/<pointer> => 1/, @_);
-}
-
-sub decl_ident_is {
-  my $id = shift @_;
-  return like( qr/<name> => \"$id/, @_);
-}
-sub type_is {
-  my $id = shift @_;
-  return like( qr/<type> => \"$id/, @_);
-}
-sub is_builtin{
-  return like( qr/<builtin_type> => 1/, @_);
-}
-
-sub contains {
-  my $it = shift @_;
-  return like( qr/$it/, @_);
-}
-
-sub parse_failure {
-  $ME->{builder}->ok( $results->[3] == 1, @_ );
-}
-
-sub parse_success {
-  my $code = shift @_;
-  $results = $ME->ncigenit($code, '--target=parse');
-  $ME->{builder}->ok( $results->[3] == 0, @_ );
-}
-
-sub ncigenit {
-    my ( $self, $code, $ncigenargs ) = @_;
-
-    my $count = $self->{builder}->current_test + 1;
-    my $parrotdir       = dirname $self->{parrot};
-
-    my @fns = map { File::Spec->rel2abs( Parrot::Test::per_test( $_, $count ) ) } ( '.c', '.out' );
-    my ( $lang_f, $out_f ) = @fns;
-
-    Parrot::Test::write_code_to_file( $code, $lang_f );
-
-    my $args = $ENV{TEST_PROG_ARGS} || '';
-
-    my $cmd       = "$self->{parrot} $args $parrotdir/compilers/ncigen/ncigen.pbc $ncigenargs $lang_f";
-    my $exit_code = Parrot::Test::run_command(
-            $cmd,
-            CD     => $self->{relpath},
-            STDOUT => $out_f,
-            STDERR => $out_f
-            );
-    my $output = Parrot::Test::slurp_file($out_f);
-
-    unless ( $ENV{POSTMORTEM} ) {
-        unlink $lang_f;
-        unlink $out_f;
-    }
-
-    my @results = ($code, $cmd, $output, $exit_code, $count);
-    wantarray ? return @results : return [ @results ];
-}
-
-sub testit {
-    my ( $self, $method, $code, $cmd, $output, $exit_code, $count, $expected, $desc ) = @_;
-    #print "$cmd, $exit_code, $count, $expected, $desc \n";
-
-    $desc = "NCIGENAST Test $count" unless $desc;
-    my $pass = $self->{builder}->$method( $output, $expected, $desc );
-    if ($exit_code or not $pass)  {
-      $self->{builder}->diag("'$cmd' failed with exit code $exit_code") if $exit_code or not $pass;
-      $self->{builder}->diag("CODE:\n$code"."CODE");
-    }
-
-    return $pass;
-}
-
-1;
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Deleted: trunk/compilers/ncigen/ncigen.pir
==============================================================================
--- trunk/compilers/ncigen/ncigen.pir	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,138 +0,0 @@
-# $Id$
-# Copyright (C) 2008, Parrot Foundation.
-
-=head1 TITLE
-
-ncigen.pir - A NCI stub compiler.
-
-=head2 Description
-
-This is the base file for the NCI stub compiler.
-
-This file includes the parsing and grammar rules from
-the src/ directory, loads the relevant PGE libraries,
-and registers the compiler under the name 'NCIGEN'.
-
-=head2 Functions
-
-=over 4
-
-=item onload()
-
-Creates the C compiler using a C<PCT::HLLCompiler>
-object.
-
-=cut
-
-.namespace [ 'NCIGEN';'Compiler' ]
-
-.loadlib 'ncigen_group'
-
-.sub 'onload' :anon :load :init
-    load_bytecode 'PCT.pbc'
-
-    .local pmc p6meta
-    p6meta = new 'P6metaclass'
-    p6meta.'new_class'('NCIGEN::Compiler', 'parent'=>'PCT::HLLCompiler')
-.end
-
-=item main(args :slurpy)  :main
-
-Start compilation by passing any command line C<args>
-to the C compiler.
-
-=cut
-
-.sub 'init' :vtable :method
-    self.'language'('NCIGEN')
-    self.'parsegrammar'('C99::Grammar')
-    self.'parseactions'('NCIGEN::Grammar::Actions')
-    $P0 = split ' ', 'parse nci_ast gen_nci_pir'
-    setattribute self, '@stages', $P0
-    $P0 = split ' ', 'e=s help|h target=s trace|t=s encoding=s output|o=s combine version|v libname|l=s nsname|n=s raw|r'
-    setattribute self, '@cmdoptions', $P0
-
-    ##  set the $usage attribute
-    $P0 = new 'String'
-    $P0 = <<'USAGE'
-Usage: ncigen [switches] [--] [preprocessedfile] [arguments]
-  -l, --libname        library to load symbols from
-  -n  --nsname         pir namepsace to place symbols into
-  -r  --raw            dump dlfunc pir statements only
-
-Standard HLLCompiler Options:
-  -e program           one line of program
-  -h, --help           display this help text
-  --target=[stage]     specify compilation stage to emit
-  -t, --trace=[flags]  enable trace flags
-  --encoding=[mode]    specify string encoding mode
-  -o, --output=[name]  specify name of output file
-  -v, --version        display version information
-USAGE
-    setattribute self, '$usage', $P0
-.end
-
-.sub 'main' :main
-    .param pmc args
-    $P0 = compreg 'NCIGEN'
-    $P2 = $P0.'command_line'(args)
-.end
-
-.namespace [ 'PCT';'HLLCompiler' ]
-
-.sub 'nci_ast' :method
-    .param pmc source
-    .param pmc adverbs         :slurpy :named
-
-  compile_match:
-    push_eh err_past
-    .local pmc ast
-    ast = source.'item'()
-    pop_eh
-    $I0 = isa ast, ['NCIGENAST';'Decls']
-    unless $I0 goto err_past
-    .return (ast)
-
-  err_past:
-    $S0 = typeof source
-    .tailcall self.'panic'('Unable to obtain NCIGENAST from ', $S0)
-.end
-
-.sub 'gen_nci_pir' :method
-    .param pmc source
-    .param pmc adverbs         :slurpy :named
-
-    $P0 = compreg 'NCIPIR'
-    $P1 = $P0.'to_pir'(source, adverbs :flat :named)
-    say $P1
-    .return ($P1)
-.end
-
-
-.include 'src/NCIGENAST.pir'
-.include 'src/NCIPIR.pir'
-.include 'src/gen_builtins.pir'
-.include 'src/gen_grammar.pir'
-.include 'src/gen_actions.pir'
-
-
-.namespace [ 'C99';'Grammar' ]
-
-.sub 'debug'
-    .param pmc match
-    .param pmc arg
-    .param pmc attrs :slurpy
-    printerr arg
-    printerr "\n"
-.end
-
-=back
-
-=cut
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
-

Deleted: trunk/compilers/ncigen/ncigen.pl
==============================================================================
--- trunk/compilers/ncigen/ncigen.pl	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,102 +0,0 @@
-#! perl
-# Copyright (C) 2008, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use Getopt::Long;
-use Pod::Usage;
-use File::Temp;
-use File::Spec;
-use IPC::Run3;
-
-my $man = 0;
-my $help = 0;
-my $PARROT = "../../parrot";
-my ($incpaths,$libname,$nsname);
-
-GetOptions('help|?'   => \$help,
-            man       => \$man,
-            libname   => \$libname,
-            nsname    => \$nsname,
-            "I=s@"    => \$incpaths) or pod2usage(2);
-pod2usage(1) if $help;
-pod2usage(-exitstatus => 0, -verbose => 2) if $man;
-
-#sub usage()
-
-sub cc_preprocess {
-  my ($file) = @_;
-  my ($volume, $directories, $fileonly) = File::Spec->splitpath( $file );
-  print "$fileonly\n";
-
-  my $ofile = mktemp( $fileonly . "_XXXX");
-  #execit("gcc -x c -fdirectives-only -E $file > $ofile");
-  execit("gcc -x c -E $file > $ofile");
-  return $ofile;
-}
-
-sub gen_NCI_signatures {
-  my ( $file, $more_args ) = @_;
-  return execit("make; $PARROT ncigen.pbc $more_args $file");
-}
-
-sub execit {
-  my ($cmd) = @_;
-  print "$cmd\n";
-  my $output = `$cmd`;
-  return $output;
-}
-
-sub main {
-  my $more_args = "";
-  $ARGV[0] = 't/spi.c' unless $ARGV[0];
-  $libname = "libexamplelib"      unless $libname;
-  $nsname  = "CLIB::examplelib"   unless $nsname;
-
-  #$more_args = "--target=parse --libname=fred --nsname=GO::Mojo";
-  $more_args = "--libname=$libname --nsname=$nsname";
-  my $preproc_fn = cc_preprocess($ARGV[0]);
-
-  my $nci_sigs = gen_NCI_signatures($preproc_fn, $more_args);
-  unlink($preproc_fn);
-  print $nci_sigs;
-}
-
-main();
-
-__END__
-
-=head1 NAME
-
-sample - Using nci_gen.pl
-
-=head1 SYNOPSIS
-
-nci_gen [options] [file ...]
-
-Options:
--help            brief help message
--man             full documentation
-
-=head1 OPTIONS
-
-=over 8
-
-=item B<-help>
-
-Print a brief help message and exits.
-
-=item B<-man>
-
-Prints the manual page and exits.
-
-=back
-
-=head1 DESCRIPTION
-
-B<nci_gen> will read the given input file c header file and create a pir interface file.
-
-=cut
-

Deleted: trunk/compilers/ncigen/src/NCIGENAST.pir
==============================================================================
--- trunk/compilers/ncigen/src/NCIGENAST.pir	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,332 +0,0 @@
-# $Id$
-
-=head1 NAME
-
-NCIGENAST - NCIGEN abstract syntax tree
-
-=head1 DESCRIPTION
-
-This file implements the various abstract syntax tree nodes
-for doing syntax analysis on c99 programs.
-
-=cut
-
-.namespace [ 'NCIGENAST';'Node' ]
-
-.sub 'onload' :anon :load :init
-    ##   create the NCIGENAST::Node base class
-    .local pmc p6meta, base, vardecl
-    p6meta = new 'P6metaclass'
-    base = p6meta.'new_class'('NCIGENAST::Node', 'parent'=>'PCT::Node')
-
-    vardecl = p6meta.'new_class'('NCIGENAST::VarDecl', 'parent'=>base)
-    p6meta.'new_class'('NCIGENAST::Decls',     'parent'=>base)
-
-    p6meta.'new_class'('NCIGENAST::TypeDef',   'parent'=>vardecl)
-    p6meta.'new_class'('NCIGENAST::FuncDecl',  'parent'=>vardecl)
-    p6meta.'new_class'('NCIGENAST::Param',     'parent'=>vardecl)
-    p6meta.'new_class'('NCIGENAST::Struct',    'parent'=>vardecl)
-    p6meta.'new_class'('NCIGENAST::Union',     'parent'=>vardecl)
-
-    .return ()
-.end
-
-.sub 'clone' :method
-    $P0 = clone self
-    .return ($P0)
-.end
-
-.sub 'item' :method
-    .return (self)
-.end
-
-=head1 NCIGENAST Node types
-
-=head2 NCIGENAST::Node
-
-C<NCIGENAST::Node> is the base class for all NCIGENAST nodes, and is
-derived from PCT::Node.  A node has an array component to
-hold its children, and a hash component for its attributes.
-However, we tend to use accessor methods for accessing the node's
-attributes instead of accessing the hash directly.
-
-Every NCIGENAST node inherits C<name>, C<source>, and C<pos> attributes
-from C<PCT::Node>.  The C<name> attribute is the node's name, if
-any, while C<source> and C<pos> are used to identify the location
-in the original source code for the node.  The C<source> and C<pos>
-values are generally set by the C<node> method inherited from
-C<PCT::Node>.
-
-Other node attributes are generally defined by subclasses of C<NCIGENAST::Node>.
-
-=over 4
-
-=item returns([value])
-
-Accessor method -- sets/returns the return type for the invocant.
-
-=cut
-
-.sub 'returns' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('returns', value, has_value)
-.end
-
-
-=item arity([value])
-
-Accessor method -- sets/returns the arity (number of expected arguments)
-for the node.
-
-=cut
-
-.sub 'arity' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('arity', value, has_value)
-.end
-
-
-=item named([value])
-
-Accessor method -- for named arguments, sets/returns the name to be
-associated with the argument.
-
-=cut
-
-.sub 'named' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('named', value, has_value)
-.end
-
-
-=item flat([value]
-
-Accessor method -- sets/returns the "flatten" flag on arguments.
-
-=cut
-
-.sub 'flat' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('flat', value, has_value)
-.end
-
-
-=back
-
-=head2 NCIGENAST::TypeDef
-
-C<NCIGENAST::Val> nodes represent constant values in the abstract
-syntax tree.  The C<name> attribute represents the value of the
-node.
-
-=over 4
-
-=item value([value])
-
-Get/set the constant value for this node.
-
-=cut
-
-.namespace [ 'NCIGENAST';'TypeDef' ]
-
-.sub 'value' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('value', value, has_value)
-.end
-
-=back
-
-=head2 NCIGENAST::Var
-
-C<NCIGENAST::Var> nodes represent variables within the abstract
-syntax tree.  The variable name (if any) is given as the node's
-C<name> attribute.
-
-=over 4
-
-=item scope([value])
-
-Get/set the NCIGENAST::Var node's "scope" (i.e., how the variable
-is accessed or set).  Allowable values include "package", "lexical",
-"parameter", and "keyed", representing HLL global, lexical, block
-parameter, and array/hash variables respectively.
-
-=cut
-
-.namespace [ 'NCIGENAST';'VarDecl' ]
-
-.sub 'source' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('source', value, has_value)
-.end
-
-.sub 'type' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('type', value, has_value)
-.end
-
-.sub 'extern' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('extern', value, has_value)
-.end
-
-.sub 'pointer' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('pointer', value, has_value)
-.end
-
-.sub 'builtin_type' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('builtin_type', value, has_value)
-.end
-
-.sub 'complex' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('complex', value, has_value)
-.end
-
-.sub 'primitive_type' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('primitive_type', value, has_value)
-.end
-
-.sub 'pointer_cnt' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('pointer_cnt', value, has_value)
-.end
-
-.sub 'scope' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('scope', value, has_value)
-.end
-
-
-=item isdecl([flag])
-
-Get/set the node's C<isdecl> attribute (for lexical variables) to C<flag>.
-A true value of C<isdecl> indicates that the variable given by
-this node is to be created within the current lexical scope.
-Otherwise, the node refers to a lexical variable from an outer scope.
-
-=cut
-
-.sub 'isdecl' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('isdecl', value, has_value)
-.end
-
-
-=item lvalue([flag])
-
-Get/set the C<lvalue> attribute, which indicates whether this
-variable is being used in an lvalue context.
-
-=cut
-
-.sub 'lvalue' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('lvalue', value, has_value)
-.end
-
-
-=item namespace([namespace])
-
-Get/set the variable's namespace attribute to the array of strings
-given by C<namespace>.  Useful only for variables with a C<scope>
-of 'package'.
-
-=cut
-
-.sub 'namespace' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('namespace', value, has_value)
-.end
-
-
-=item slurpy([flag])
-
-Get/set the node's C<slurpy> attribute (for parameter variables) to C<flag>.
-A true value of C<slurpy> indicates that the parameter variable given by this
-node is to be created as a slurpy parameter (consuming all remaining arguments
-passed in).
-
-=cut
-
-.sub 'slurpy' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('slurpy', value, has_value)
-.end
-
-
-=item viviself([type])
-
-If the variable needs to be instantiated, then C<type> indicates
-either the type of the value to create for the node or (future
-implementation) a NCIGENAST tree to create the value.
-
-=cut
-
-.sub 'viviself' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('viviself', value, has_value)
-.end
-
-
-=item vivibase([type])
-
-For keyed nodes, C<type> indicates the type of aggregate to
-create for the base if the base doesn't specify its own 'viviself'
-attribute.
-
-=cut
-
-.sub 'vivibase' :method
-    .param pmc value           :optional
-    .param int has_value       :opt_flag
-    .tailcall self.'attr'('vivibase', value, has_value)
-.end
-
-
-=back
-
-=head2 NCIGENAST::Op
-
-C<NCIGENAST::Op> nodes represent the operations in an abstract syntax
-tree.  The primary function of the node is given by its C<pasttype>,
-secondary functions may be given by the node's C<name>, C<pirop>,
-or other attributes.
-
-
-=head1 HISTORY
-
-
-=head1 COPYRIGHT
-
-Copyright (C) 2006-2008, Parrot Foundation.
-
-=cut
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:

Deleted: trunk/compilers/ncigen/src/NCIPIR.pir
==============================================================================
--- trunk/compilers/ncigen/src/NCIPIR.pir	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,367 +0,0 @@
-# $Id$
-
-=head1 NAME
-
-NCIPIR::Compiler - NCI PIR Compiler for NCIGENAST trees.
-
-=head1 DESCRIPTION
-
-NCIPIR::Compiler defines a compiler that converts a NCIGENAST tree into PIR
-
-=head1 METHODS
-
-=over
-
-=cut
-
-.namespace [ 'NCIPIR';'Compiler' ]
-
-.sub '__onload' :load :init
-    .local pmc p6meta, cproto
-    p6meta = new 'P6metaclass'
-    cproto = p6meta.'new_class'('NCIPIR::Compiler', 'parent'=>'PCT::HLLCompiler', 'attr'=>'$!code')
-    cproto.'language'('NCIPIR')
-    $P1 = split ' ', 'pir evalpmc'
-    cproto.'stages'($P1)
-
-    $P0 = new 'String'
-    set_global '$?NAMESPACE', $P0
-    .return ()
-.end
-
-
-.sub 'to_pir' :method
-    .param pmc ast
-    .param pmc adverbs         :slurpy :named
-
-    .local pmc newself
-    newself = new ['NCIPIR';'Compiler']
-
-    ##  start with empty code
-    .local pmc code
-    code = new 'CodeString'
-    newself.'code'(code)
-
-    ##  if the root node isn't a Sub, wrap it
-    $I0 = isa ast, ['NCIGENAST';'Decls']
-    if $I0 goto have_sub
-    $P0 = get_hll_global ['NCIGENAST'], 'Decls'
-    ast = $P0.'new'(ast, 'name'=>'anon')
-  have_sub:
-
-    .local string raw
-
-    raw = adverbs['raw']
-    if raw goto Lgenpir
-    $P0 = newself.'gen_preamble'(adverbs :flat :named)
-  Lgenpir:
-    ##  now generate the pir
-    newself.'pir'(ast)
-
-    ##  and return whatever code was generated
-    .tailcall newself.'code'()
-.end
-
-.sub 'gen_preamble' :method
-    .param pmc adverbs         :slurpy :named
-    .local string nsname
-    .local string libname
-    .local string fmt
-
-    nsname = adverbs['nsname']
-    libname = adverbs['libname']
-
-fmt = <<'FMT'
-.namespace ['%n']
-.sub __load_lib_dlfunc_init__ :anon :init :load
-FMT
-
-    .local pmc code
-    code = new 'CodeString'
-    code.'emit'(fmt, 'n'=>nsname)
-    if null libname goto LNOLIBNAME
-fmt = <<'FMT'
-loadlib $P1, '%l'
-if $P1 goto has_lib
-FMT
-    goto LEMITLIBNAME
-  LNOLIBNAME:
-fmt = <<'FMT'
-$P1 = null
-goto has_lib
-FMT
-  LEMITLIBNAME:
-    code.'emit'(fmt, 'l'=>libname)
-
-
-fmt = <<'FMT'
-$P2 = new 'Exception'
-$P2[0] = 'error loading %l - loadlib failed'
-throw $P2
-has_lib:
-FMT
-    code.'emit'(fmt, 'l'=>libname)
-    $P0 = self.'code'()
-    $P0 .= code
-    .return(code)
-.end
-
-
-=item code([str])
-
-Get/set the code generated by this compiler.
-
-=cut
-
-.sub 'code' :method
-    .param pmc code            :optional
-    .param int has_code        :opt_flag
-
-    if has_code goto set_code
-    code = getattribute self, '$!code'
-    .return (code)
-  set_code:
-    setattribute self, '$!code', code
-    .return (code)
-.end
-
-
-=item pir_children(node)
-
-Return generated PIR for C<node> and all of its children.
-
-=cut
-
-.sub 'pir_children' :method
-    .param pmc node
-    .local pmc code, it
-    code = new 'CodeString'
-    it   = iter node
-  iter_loop:
-    unless it goto iter_end
-    .local string key
-    .local pmc cast
-    key = shift it
-    cast = node[key]
-    $P0 = self.'pir'(cast)
-    code .= $P0
-    goto iter_loop
-  iter_end:
-    .return (code)
-.end
-
-
-=item pir(Any node)
-
-Return generated pir for any POST::Node.  Returns
-the generated pir of C<node>'s children.
-
-=cut
-
-.sub 'pir' :method :multi(_,_)
-    .param pmc node
-    .local string code
-    code = self.'pir_children'(node)
-    $P0 = self.'code'()
-    $P0 .= code
-    .return ($P0)
-.end
-
-
-=item pir(POST::Op node)
-
-Return pir for an operation node.
-
-=cut
-
-.sub 'pir' :method :multi(_,['NCIGENAST';'FuncDecl'])
-    .param pmc node
-
-    ##  get list of arguments to operation
-    .local pmc arglist
-    arglist = node.'list'()
-
-    .local string fmt, name, type
-    type = param_to_code(node, 1)
-
-    .local pmc itera
-    .local pmc param
-    iter itera, arglist
-    LIS:
-    unless itera, LI0
-    param = shift itera
-    $S0 = param_to_code(param)
-    #say $S0
-    type .= $S0
-    goto LIS
-
-    LI0:
-    name = node.'name'()
-    fmt = "dlfunc $P2, $P1, '%n', '%s'\nstore_global '%n', $P2"
-
-    #$S0 = "##"
-    #$S1 = node.'attr'('source', '', 0)
-    #$S0 .= $S1
-    #print $S0
-
-    .local pmc code
-    code = new 'CodeString'
-    code.'emit'(fmt, 's'=>type, 'n'=>name)
-    #$S0 = code
-    #say $S0
-
-    .return (code)
-.end
-
-.sub 'param_to_code'
-  .param pmc node
-  .param int returncode :optional
-  $I0 = node.'pointer'()
-  $I2 = node.'pointer_cnt'()
-  $S0 = node.'primitive_type'()
-
-
-  if $I0, LPOINTER
-
-  iseq $I1, $S0, 'void'
-  unless $I1, LL2
-  if returncode, LL11
-    .return("")
-  LL11:
-    .return("v")
-  LL2:
-  iseq $I1, $S0, 'int'
-  unless $I1, LL3
-    .return("i")
-  LL3:
-  iseq $I1, $S0, 'long'
-  unless $I1, LL4
-    .return("l")
-  LL4:
-  iseq $I1, $S0, 'char'
-  unless $I1, LL5
-    .return("c")
-  LL5:
-  iseq $I1, $S0, 'short'
-  unless $I1, LL6
-    .return("s")
-  LL6:
-    .return("p")
-
-  LPOINTER:
-  isgt $I3, $I2, 1
-  if $I3, LL18 # pointer_cnt > 1
-
-  iseq $I1, $S0, 'void' #void *
-  unless $I1, LL7
-  if returncode, LL111
-    .return("p")
-  LL111:
-    .return("p")
-#    .return("V") #probably should be this
-  LL7:
-  iseq $I1, $S0, 'char' #char *
-  unless $I1, LL8
-    .return("t")
-  LL8:
-  iseq $I1, $S0, 'int' #int *
-  unless $I1, LL13
-    .return("V")
-  LL13:
-  iseq $I1, $S0, 'long' #long *
-  unless $I1, LL14
-    .return("V")
-  LL14:
-  iseq $I1, $S0, 'short' #short *
-  unless $I1, LL15
-    .return("V")
-  LL15: #struct *, typedef *,
-    say "ERROR"
-    say $S0
-    say "what is this"
-    .return("p")
-
-#something **
-  LL18:
-    .return("V")
-.end
-
-=item pir(POST::Label node)
-
-Generate a label.
-
-=cut
-
-.sub 'pir' :method :multi(_, ['NCIGENAST';'TypeDef'])
-    .param pmc node
-    .return ('')
-    .tailcall pir_dump(node)
-.end
-
-=item pir(POST::Label node)
-
-Generate a label.
-
-=cut
-
-.sub 'pir' :method :multi(_, ['NCIGENAST';'VarDecl'])
-    .param pmc node
-    .return ('')
-    .tailcall pir_dump(node)
-.end
-
-=item pir(POST::Label node)
-
-Generate a label.
-
-=cut
-
-.sub 'pir_dump'
-    .param pmc node
-    .local string code
-    code = '#'
-    code .= 'typedef '
-    $S0 = node.'type'()
-    code .= $S0
-    code .= ' '
-    $S0 = node.'name'()
-    code .= $S0
-    $S0 = node.'builtin_type'()
-    unless $S0 goto LN1
-    code .= ' builtin '
-    code .= $S0
-  LN1:
-    $S0 = node.'pointer'()
-    unless $S0 goto LN2
-    code .= ' pointer '
-    code .= $S0
-  LN2:
-    code .= ":\n"
-    print code
-    .return ('')
-.end
-
-
-=back
-
-=head1 AUTHOR
-
-Patrick Michaud <pmichaud at pobox.com> is the author and maintainer.
-Please send patches and suggestions to the Parrot porters or
-Perl 6 compilers mailing lists.
-
-=head1 HISTORY
-
-2007-11-21  Significant refactor as part of Parrot Compiler Toolkit
-
-=head1 COPYRIGHT
-
-Copyright (C) 2006-2008, Parrot Foundation.
-
-=cut
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:

Deleted: trunk/compilers/ncigen/src/builtins/say.pir
==============================================================================
--- trunk/compilers/ncigen/src/builtins/say.pir	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,85 +0,0 @@
-# Copyright (C) 2008-2009, Parrot Foundation.
-# $Id$
-
-=head1
-
-say.pir -- simple implementation of a say function
-
-=cut
-
-.namespace []
-
-.sub 'say'
-    .param pmc args            :slurpy
-    .local pmc it
-    it = iter args
-  iter_loop:
-    unless it goto iter_end
-    $P0 = shift it
-    print $P0
-    goto iter_loop
-  iter_end:
-    print "\n"
-    .return ()
-.end
-
-.sub 'printf'
-    .param pmc format
-    .param pmc args   :slurpy
-    .local pmc it
-    it = iter args
-  iter_loop:
-    unless it goto iter_end
-    $P0 = shift it
-    print $P0
-    goto iter_loop
-  iter_end:
-.end
-
-.sub 'puts'
-    .param pmc str
-    print str
-    print "\n"
-.end
-
-.sub 'infix:<'
-    .param pmc a
-    .param pmc b
-    islt $I0, a, b
-    .return ($I0)
-.end
-
-.sub 'postfix:++'
-    .param pmc arg
-    $P0 = clone arg
-    inc $P0
-    .return (arg)
-.end
-
-.sub 'postfix:--'
-    .param pmc arg
-    $P0 = clone arg
-    dec $P0
-    .return (arg)
-.end
-
-.sub 'prefix:++'
-    .param pmc arg
-    inc arg
-    .return (arg)
-.end
-
-.sub 'prefix:--'
-    .param pmc arg
-    dec arg
-    .return (arg)
-.end
-
-
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
-

Deleted: trunk/compilers/ncigen/src/parser/actions.pm
==============================================================================
--- trunk/compilers/ncigen/src/parser/actions.pm	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,261 +0,0 @@
-# $Id$
-# Copyright (C) 2008, Parrot Foundation.
-
-=begin comments
-
-NCIGEN::Grammar::Actions - ast transformations for NCIGEN
-
-This file contains the methods that are used by the parse grammar
-to build the PAST representation of an C program.
-Each method below corresponds to a rule in F<src/parser/grammar.pg>,
-and is invoked at the point where C<{*}> appears in the rule,
-with the current match object as the first argument.  If the
-line containing C<{*}> also has a C<#= key> comment, then the
-value of the comment is passed as the second argument to the method.
-
-=end comments
-
-
-class NCIGEN::Grammar::Actions;
-
-our $decls := NCIGENAST::Decls.new();
-our $NCIGENDEBUG :=0;
-
-method TOP($/) {
-    if $NCIGENDEBUG { _dumper($decls); }
-    make $decls;
-}
-
-sub parse_decl_specs($/, $ast) {
-    if $/ {
-        for $/ {
-            $ast.attr( strip_spaces(~$_), 1, 1);
-        }
-    }
-}
-
-sub typedef($/) {
-    if $/ {
-        for $/ {
-            if ('typedef' eq strip_spaces(~$_) ) { return 1; }
-        }
-    }
-    return 0;
-}
-
-method declaration($/) {
-    my $ast := NCIGENAST::VarDecl.new() ;
-    my $type := "";
-
-#    say("=================================================================================================");
-#    _dumper($/);
-#    make $decls;
-#    return 1;
-    my $decl_specs := $<declaration_specifiers><repeatable_declaration_specifiers>;
-    if typedef($decl_specs) {
-        $ast := NCIGENAST::TypeDef.new( );
-        $type := "TypeDef";
-    }
-    elsif $/<init_declarator><init_declarator><declarator><direct_declarator><declarator_suffix><declarator_suffix><parameter_type_list> {
-        $ast := NCIGENAST::FuncDecl.new( );
-        $type := "FuncDecl";
-    }
-#    elsif $<declaration_specifiers><type_specifier><type> {
-#        $ast := NCIGENAST::Struct.new( :node($/) );
-#        $type := "Struct";
-#    }
-    else {
-        $ast := NCIGENAST::VarDecl.new( );
-        $type := "VarDecl";
-    }
-    parse_decl_specs( $<declaration_specifiers><repeatable_declaration_specifiers>, $ast );
-
-    #  TYPE
-    settype($<declaration_specifiers><type_specifier>, $ast);
-
-    if ($type eq "FuncDecl") {
-        if (+$<init_declarator> != 1) {
-            say("ERROR FuncDecl has more than one <init_declarator>");
-        }
-
-        #assert(+$<init_declarator><declarator><direct_declarator><declarator_suffix>  == 1);
-        my $params := $<init_declarator><declarator><declarator><direct_declarator><declarator_suffix><parameter_type_list><parameter_type_list><parameter_list><parameter_declaration>;
-        for $params {
-            my $param := NCIGENAST::Param.new( );
-
-            settype($_<declaration_specifiers><type_specifier>, $param);
-            my $param_ident := $_<declarator>;
-            if $param_ident { setname( $_, $param ); }
-            ispointer($_, $param);
-            $ast.push( $param );
-        }
-        my $declarator := $<init_declarator><declarator>;
-        my $name := setname($declarator, $ast);
-        $decls{ $name } := $ast;
-        ispointer($declarator, $ast);
-        #if $NCIGENDEBUG { _dumper($ast); }
-        #say($name);
-    }
-    #elsif ($type eq "VarDecl") {
-    #elsif $<init_declarator> {
-    else {
-        for $<init_declarator> {
-            my $l_ast := $ast.clone();
-
-            my $name := setname($_, $l_ast);
-            $decls{ $name } := $l_ast;
-            ispointer($_, $l_ast);
-            #if $NCIGENDEBUG { _dumper($l_ast); }
-            #say($name);
-        }
-    }
-    #else {
-    #    say("OPAQUE STRUCT OR UNTION");
-    #    _dumper($/);
-    #}
-
-    make $decls;
-}
-
-sub countpointer($/) {
-    if $<pointer> {
-        return countpointer($<pointer>) + 1;
-    }
-    else {
-        return 0;
-    }
-}
-
-sub ispointer($/, $ast) {
-    if $/ {
-        if ($<declarator><pointer>)  {
-            $ast.pointer(1);
-            $ast.pointer_cnt(countpointer($<declarator><pointer>));
-        }
-        if ($<abstract_declarator><pointer>)  {
-            $ast.pointer(1);
-            $ast.pointer_cnt(countpointer($<abstract_declarator><pointer>));
-        }
-    }
-
-    my $lookup_ast := $ast;
-    repeat {
-=begin comment
-        if $lookup_ast.pointer() {
-            $ast.pointer(1);
-            my $pc := +$ast.pointer_cnt();
-            $pc++;
-            $ast.pointer_cnt($pc);
-        }
-=end comment
-
-        if $lookup_ast.builtin_type() {
-            $ast.primitive_type(~($lookup_ast.type()));
-            return 1;
-        }
-        my $type_name := $lookup_ast.type();
-        my $lookup_ast_name := $lookup_ast.name();
-
-        #FIXME struct or union typedef
-        if ($lookup_ast.name() eq $type_name) {
-            return 1;
-        }
-
-        $lookup_ast := $decls{$type_name};
-        unless $lookup_ast {
-            #say("Parent " ~~ $lookup_ast_name ~~ " " ~~ $type_name ~~ " not defined");
-            return 1;
-        }
-        if $lookup_ast.pointer() {
-            $ast.pointer(1);
-            my $pc := +$ast.pointer_cnt();
-            $pc := $pc + $lookup_ast.pointer_cnt();
-            $ast.pointer_cnt($pc);
-        }
-    } while (1);
-    #_dumper($ast);
-}
-
-sub settype($/, $ast) {
-    if $/ {
-        #is it a struct or union
-        my $struct_or_union := strip_spaces(~$<type>);
-        if $struct_or_union {
-            my $ident := $<struct_or_union_specifier><identifier><identifier>;
-            if $ident {
-                $ident := strip_spaces(~$ident);
-            }
-            else {
-                $ident := $<struct_or_union_specifier><identifier>;
-                if $ident {
-                    $ident := strip_spaces(~$ident);
-                }
-                else {
-                    $ident := "anonymous_" ~~ $struct_or_union~~ "1";
-                }
-            }
-            $ast.type($ident);
-            my $s_or_u := $<struct_or_union_specifier><struct_declaration>;
-            if $s_or_u {
-                my $su;
-                if ($struct_or_union eq "struct" ) {
-                    $su := NCIGENAST::Struct.new( );
-                }
-                else {
-                    $su := NCIGENAST::Union.new( );
-                }
-                $su.name($ident);
-                build_struct_or_union($s_or_u, $su);
-                $ast.complex($su);
-            }
-        }
-        else {
-            $ast.type(strip_spaces(~$/));
-            #  BUILTIN_TYPE
-            if $<builtin_type> { $ast.builtin_type(1); }
-        }
-    }
-    else {
-        say("ERROR no type specifier");
-    }
-}
-
-sub strip_spaces($_) {
-    $_.replace(' ', '');
-    return $_;
-}
-
-sub build_struct_or_union($/, $ast) {
-    for $/ {
-        my $smt := NCIGENAST::VarDecl.new( );
-        settype( $_<specifier_qualifier_list><type_specifier>, $smt );
-        for $_<struct_declarator_list> {
-            my $sm := $smt.clone();
-            my $declarator := $_<struct_declarator><declarator>;
-            $sm.name(strip_spaces(~$declarator));
-            ispointer($declarator, $sm);
-            $ast.push($sm);
-        }
-    }
-}
-
-sub setname($/, $ast) {
-    my $name_node := $<declarator><direct_declarator><declarator_prefix>;
-    if $name_node {
-        $ast.name( ~$name_node );
-        return ~$name_node;
-    }
-    else {
-        say("ERROR node doesn't have <direct_declarator><declarator_prefix>");
-        _dumper($/);
-    }
-}
-
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 syntax=perl6:
-

Deleted: trunk/compilers/ncigen/src/parser/grammar.pg
==============================================================================
--- trunk/compilers/ncigen/src/parser/grammar.pg	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,775 +0,0 @@
-# $Id$
-# Copyright (C) 2008, Parrot Foundation.
-
-=begin overview
-
-This is the grammar for C99 written as a sequence of Perl 6 rules.
-
-
-taken from n869.pdf
-google for n869.pdf
-http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/n869/n869.pdf.gz
-
-=end overview
-
-grammar C99::Grammar is PCT::Grammar;
-
-## A.2.4 External definitions
-##
-## {{ _dumper(match) }}
-
-token TOP {
-    ^
-    <external_declaration>+
-    [ $ || <.panic: Syntax error> ]
-    {*}
-}
-
-rule external_declaration {
-    | <declaration> {*}                                   #= declaration
-    | <function_definition> {*}                           #= function_definition
-#    <declaration_specifiers>
-#    [
-#    | <declaration2>
-#    | <func_decl2>
-#    ]
-}
-
-rule func_decl2 {
-    <declarator>
-    <declaration>*
-    <compound_statement>
-    {*}
-}
-
-rule declaration2 {
-    [ <init_declarator> [',' <init_declarator>]* ]?
-    ';'
-    {*}
-}
-
-rule function_definition {
-    <declaration_specifiers>
-    <declarator>
-    <declaration>*
-    <compound_statement>
-    {*}
-}
-
-
-## A.2.2
-##
-
-rule declaration {
-    <declaration_specifiers>
-    [ <init_declarator> [',' <init_declarator>]* ]?
-    ';'
-    {*}
-}
-
-rule declaration_specifiers {
-    <repeatable_declaration_specifiers>*
-    <type_specifier>
-    <repeatable_declaration_specifiers>*
-    {*}
-}
-#rule declaration_specifiers_orig { [ <storage_class_specifier> | <type_specifier> | <type_qualifier> | <function_specifier> ]+ {*} }
-#rule declaration_specifiers { [ <declaration_specifiers_inside> ]+ {*} }
-#rule declaration_specifiers_inside { [ <storage_class_specifier> | <type_specifier> | <type_qualifier> | <function_specifier> ] {{ _dumper(match) }} }
-token builtin_type_specifier { 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' | '_Bool' | '_Complex' | '_Imaginary' }
-
-
-rule repeatable_declaration_specifiers {
-    [
-    | <storage_class_specifier>
-    | <type_qualifier>
-    | <function_specifier>
-    ]
-}
-
-rule function_specifier {
-    | 'inline'
-    | '__inline__'
-}
-
-rule init_declarator {
-    <declarator> ['=' <initializer>]?
-    {*}
-}
-
-rule storage_class_specifier {
-    [
-    | $<typedef>=['typedef']                    {*} #= typedef
-    | $<extern>=['extern']                      {*} #= extern
-    | $<static>=['static']                      {*} #= static
-    | $<auto>=['auto']                          {*} #= auto
-    | $<register>=['register']                  {*} #= register
-    | $<__extension__>=['__extension__']        {*} #= __extension__
-    ]
-}
-
-rule type_specifier {
-    #| <builtin_type_specifier>
-    | <builtin_type>
-    | $<type>=[ 'struct' | 'union' ] <struct_or_union_specifier>
-    | 'enum' <enum_specifier>
-    | $<typedef_name>=<identifier>
-}
-
-token builtin_type {
-  [
-    [
-      $<signed>=[ 'signed' | 'unsigned' ] <.ws> 
-    ]?
-    [
-    | 'void'
-    | 'char'
-    | 'short' <.ws> 'int' >>
-    | 'short'
-    | 'int'
-    | 'long' <.ws> 'long' <.ws> 'int' >>
-    | 'long' <.ws> 'long' >>
-    | 'long' <.ws> 'int' >>
-    | 'long' <.ws> 'double' >>
-    | 'long'
-    | 'float'
-    | 'double'
-    | '_Bool'
-    | '_Complex'
-    | '_Imaginary'
-    ]
-    >>
-  | 'unsigned'
-  | 'signed'
-  ]
-}
-
-rule struct_or_union_specifier {
-    | <identifier>? '{' <struct_declaration>+ '}'
-    | <identifier>
-}
-
-rule struct_declaration {
-    <specifier_qualifier_list> <struct_declarator_list>* ';'
-}
-
-rule specifier_qualifier_list {
-    <type_qualifier>*
-    <type_specifier>
-    <type_qualifier>*
-#    [
-#    | <type_specifier>
-#    | <type_qualifier>
-#    ]+
-}
-
-rule struct_declarator_list {
-    <struct_declarator> [',' <struct_declarator>]*
-}
-
-rule struct_declarator {
-    | <declarator>? ':' <constant_expression>
-    | <declarator>
-}
-
-rule enum_specifier {
-    | <identifier>? '{' <enumerator_list> [',']? '}'
-    | <identifier>
-}
-
-rule enumerator_list {
-    <enumerator> [',' <enumerator>]*
-}
-
-rule enumerator {
-    <enumeration_constant> ['=' <constant_expression>]?
-}
-
-rule type_qualifier {
-    $<qualifier>=[
-    |'const'
-    |'restrict'
-    |'volatile'
-    |'__const'       # gcc version of const
-    |'__restrict'    # gcc version of restricted
-    |'__volatile'    # gcc version of volatile
-    |'__extension__' # gcc extension
-    ]
-}
-
-rule declarator {
-    <pointer>?
-    <direct_declarator>
-    {*}
-}
-
-rule direct_declarator {
-    <declarator_prefix>
-    <declarator_suffix>*
-    <gcc_asm>?
-    <gcc_attribute>*
-    {*}
-}
-
-rule declarator_prefix {
-    | '(' <declarator> ')' {*}       #= declarator
-    | <identifier> {*}               #= identifier
-}
-
-rule declarator_suffix {
-    | '(' <parameter_type_list> ')' {*}    #= parameter_type_list
-    | '(' <identifier_list>? ')' {*}       #= identifier_list ## old-style C parameter declarations
-    | '[' <assignment_expression>? ']'
-    | '[' '*' ']'
-}
-
-rule gcc_attribute {
-    '__attribute__' '((' <gcc_attributes_list>'))'
-}
-
-rule gcc_attributes_list {
-    [<gcc_attr> [',' <gcc_attr>]* ]?
-
-}
-
-rule gcc_attr {
-    | 'noreturn'
-    | '__noreturn__'
-    | [ 'format' | '__format__' ] '(' <gcc_attr_formats> ',' <digit>+ ',' <digit>+ ')'
-    | '__const__'
-    | '__const'
-    | '__nothrow__'
-    | '__aligned__' '(' <digit>+ ')'
-    | '__format_arg__' '(' <digit>+ ')'
-    | '__nonnull__' '(' <digit_list_plus> ')'
-    | '__mode__' '(' <gcc_attr_mode> ')'
-    | '__sentinel__' '(' <digit>+ ')'
-    | '__malloc__'
-    | '__pure__'
-    | '__warn_unused_result__'
-}
-
-rule digit_list_plus {
-  <digit>+ [',' <digit>+ ]*
-  {*}
-}
-
-
-token gcc_attr_mode {
-    | '__QI__'
-    | '__DI__'
-    | '__SI__'
-    | '__HI__'
-    | 'byte'
-    | '__byte__'
-    | 'word'
-    | '__word__'
-    | 'pointer'
-    | '__pointer__'
-}
-
-token gcc_attr_formats {
-    | printf
-    | __printf__
-    | scanf
-    | strftime
-    | gnu_printf
-    | gnu_scanf
-    | gnu_strftime
-    | strfmon
-    | __printf__
-    | __scanf__
-    | __strftime__
-    | __strfmon__
-    | ms_printf
-    | ms_scanf
-    | ms_strftime
-}
-
-rule gcc_asm {
-    [ 'asm' | '__asm__' ]
-    '('
-    [<c_string_literal> ]*
-    ')'
-}
-
-rule pointer {
-    |'*' [ <type_qualifier> ]* <pointer>
-    |'*' [ <type_qualifier> ]*
-}
-
-rule parameter_type_list {
-    <parameter_list>  [$<vararg>=[',' '...']]?
-    {*}
-}
-
-rule parameter_list {
-    <parameter_declaration> [',' <parameter_declaration>]*
-    {*}
-}
-
-rule parameter_declaration {
-    <declaration_specifiers>
-    [
-    | <declarator> {*}               #= declarator
-    | <abstract_declarator>? {*}     #= abstract_declarator
-    ]
-    <repeatable_declaration_specifiers>*
-}
-
-rule identifier_list {
-    <identifier> [',' <identifier>]*
-}
-
-rule type_name {
-    <specifier_qualifier_list> <abstract_declarator>?
-}
-
-rule abstract_declarator {
-    | <pointer>
-    | <pointer>? <direct_abstract_declarator>
-}
-
-rule direct_abstract_declarator {
-    [
-    | '(' <abstract_declarator> ')'
-    | '[' <assignment_expression>? ']'
-    | '[' '*' ']'
-    | '(' <parameter_type_list> ')'
-    ]
-    <direct_abstract_declarator_1>*
-}
-
-rule direct_abstract_declarator_1 {
-    | '[' <assignment_expression>? ']'
-    | '[' '*' ']'
-    | '(' <parameter_type_list> ')'
-}
-
-rule typedef_name_DEAD_CODE {
-
-## a typedef name can be a return type specifier. This is ambiguous, because
-## the parser doesn't know if it's a return type thingie or the name of the
-## function. Therefore, typedef'd names must be stored in a %hash, so that
-## this rule is not calling <identifier>, but inspecting the registered
-## typedef'd names. For now, specify 'SOME_TYPEDEF_NAME' as the only typedef'd name.
-##
-    <identifier>
-    #'SOME_TYPEDEF_NAME'
-}
-
-rule initializer {
-    | <assignment_expression>
-    | '{' <initializer_list> [',']? '}'
-}
-
-rule initializer_list {
-    <initializer_item> [',' <initializer_item>]*
-}
-
-rule initializer_item {
-    <designation>? <initializer>
-}
-
-rule designation {
-    <designator>+ '='
-}
-
-rule designator {
-    | '[' <constant_expression> ']'
-    | '.' <identifier>
-}
-
-
-## A.2.3 Statements
-##
-
-rule statement {
-    | <labeled_statement>
-    | <compound_statement> {*}        #= compound_statement
-    | <expression_statement> {*}      #= expression_statement
-    | <if_statement> {*}              #= if_statement
-    | <switch_statement>
-    | <while_statement> {*}           #= while_statement
-    | <do_while_statement> {*}        #= do_while_statement
-    | <for1_statement> {*}            #= for1_statement
-    | <for2_statement> {*}            #= for2_statement
-    | <jump_statement> {*}            #= jump_statement
-}
-
-rule labeled_statement {
-    | <identifier> ':' <statement>
-    | 'case' <constant_expression> ':' <statement>
-    | 'default' ':' <statement>
-}
-
-rule compound_statement {
-    '{' <block_item>* '}'
-    {*}
-}
-
-rule block_item {
-    | <declaration> {*}    #= declaration
-    | <statement> {*}      #= statement
-}
-
-rule expression_statement {
-    <expression>? ';'
-    {*}
-}
-
-rule if_statement {
-    'if' '(' <expression> ')' <statement> ['else' $<else>=<statement>]?
-    {*}
-}
-
-rule switch_statement {
-    'switch' '(' <expression> ')' <statement>
-}
-
-rule while_statement {
-    'while' '(' <expression> ')' <statement>
-    {*}
-}
-
-rule do_while_statement {
-    'do' <statement> 'while' '(' <expression> ')' ';'
-    {*}
-}
-
-rule for1_statement {
-    'for' '(' [$<init>=<expression>]? ';' [$<cond>=<expression>]? ';' [$<step>=<expression>]? ')'
-    <statement>
-    {*}
-}
-
-rule for2_statement {
-    'for' '(' <declaration> [$<cond>=<expression>]? ';' [$<step>=<expression>]? ')' <statement>
-    {*}
-}
-
-rule jump_statement {
-    | 'goto' <identifier> ';' {*}         #= goto
-    | 'continue' ';' {*}                  #= continue
-    | 'break' ';' {*}                     #= break
-    | 'return' <expression>? ';' {*}      #= return
-}
-
-
-## A.1.1 Lexical elements
-##
-##rule token {
-##  | <keyword>
-##  | <identifier>
-##  | <constant>
-##  | <c_string_literal>
-##  | <punctuator>
-##}
-
-## A.1.2 Keywords
-##
-token keyword {
-  [ auto      | enum      | restrict  | unsigned
-  | break     | extern    | return    | void
-  | case      | float     | short     | volatile
-  | char      | for       | signed    | while
-  | const     | goto      | sizeof    | _Bool
-  | continue  | if        | static    | _Complex
-  | default   | inline    | struct    | _Imaginary
-  | do        | int       | switch
-  | double    | long      | typedef
-  | else      | register  | union     ]>>
-
-}
-
-token reserved_word {
-    <keyword>
-}
-
-
-token identifier {
-    <!reserved_word>
-    <.identifier_nondigit> [ <.identifier_nondigit> | <.digit> ]*
-    {*}
-}
-
-token identifier_nondigit {
-    <alpha> | <[_]> | <universal_character_name>
-}
-
-## A.1.4 Universal character names
-##
-token universal_character_name {
-  | '\u' <xdigit>**{4}
-  | '\U' <xdigit>**{8}
-}
-
-
-## A.1.5 Constants
-##
-token constant {
-    | <floating_constant> {*}       #= floating_constant
-    | <integer_constant> {*}        #= integer_constant
-    | <enumeration_constant> {*}    #= enumeration_constant
-    | <character_constant> {*}      #= character_constant
-}
-
-token integer_constant {
-    [ <decimal_constant>
-    | <hexadecimal_constant>
-    | <octal_constant>
-    ]
-    <integer_suffix>?
-    {*}
-}
-
-token decimal_constant {
-    <[1..9]> <digit>*
-}
-
-token octal_constant {
-    0 <[0..7]>*
-}
-
-token hexadecimal_constant {
-    0 <[xX]> <xdigit>+
-}
-
-token integer_suffix {
-    | <[uU]> [ll?|LL?]?
-    | [ll?|LL?] <[uU]>?
-}
-
-token floating_constant {
-    [
-    | <decimal_floating_constant>
-    | <hexadecimal_floating_constant>
-    ]
-    {*}
-}
-
-token decimal_floating_constant {
-    [
-    | <fractional_constant> <exponent_part>?
-    | <digit_sequence> <exponent_part>
-    ]
-    <floating_suffix>?
-}
-
-token hexadecimal_prefix {
-  0 <[xX]>
-}
-
-token hexadecimal_floating_constant {
-  <hexadecimal_prefix>
-  [
-  | <hexadecimal_fractional_constant>
-  | <hexadecimal_digit_sequence>
-  ]
-  <binary_exponent_part> <floating_suffix>?
-}
-
-token fractional_constant {
-  | <digit_sequence>? \. <digit_sequence>
-  | <digit_sequence> \.
-}
-
-token exponent_part {
-  <[eE]> ['+'|'-']? <digit_sequence>
-}
-
-token digit_sequence { <digit>+ }
-
-token hexadecimal_fractional_constant {
-  | <hexadecimal_digit_sequence>? \. <hexadecimal_digit_sequence>
-  | <hexadecimal_digit_sequence> \.
-}
-
-token binary_exponent_part {
-  <[pP]> ['+'|'-']? <digit_sequence>
-}
-
-token hexadecimal_digit_sequence { <xdigit>+ }
-
-token floating_suffix { <[fFlL]> }
-
-token enumeration_constant { <identifier> }
-
-token character_constant { [L]? \' <c_char>+ \' }
-
-token <c_char> { <-['\\\n]> | <escape_sequence> }
-
-token escape_sequence {
-  \\
-  [ <['"?\\abfnrtv]>
-  | <octal_digit>**{1..3}
-  | x <xdigit>+
-  | <universal_character_name>
-  ]
-}
-
-## A.1.6 String literals
-token c_string_literal {
-    [L]? '"' <string_literal: '"'> '"'
-    {*}
-}
-
-##\" <s_char>* \"
-
-token s_char { <-["\\\n]> | <escape_sequence> }
-
-
-## A.2 Phrase structure grammar
-##
-
-## A.2.1 Expressions
-##
-
-rule constant_expression {
-    <conditional_expression>
-    {*}
-}
-
-rule expression {
-    <assignment_expression> [',' <assignment_expression>]*
-    {*}
-}
-
-rule assignment_expression {
-    [<unary_expression> <assign_op>]* <conditional_expression>
-    {*}
-}
-
-rule assign_op { '='|'*='|'/='|'%='|'+='|'-='|'<<='|'>>='|'&='|'^='|'|=' }
-
-rule conditional_expression {
-    <logical_expression> ['?' <expression> ':' <conditional_expression>]?
-    {*}
-}
-
-rule logical_expression is optable { ... }
-
-proto 'infix:||' is precedence('1') { ... }
-
-proto 'infix:&&' is tighter('infix:||') { ... }
-
-proto 'infix:|' is tighter('infix:&&') { ... }
-
-proto 'infix:^' is tighter('infix:|') { ... }
-
-proto 'infix:&' is tighter('infix:^') { ... }
-
-proto 'infix:==' is tighter('infix:&') { ... }
-proto 'infix:!=' is equiv('infix:==') { ... }
-
-proto 'infix:<' is tighter('infix:==') { ... }
-proto 'infix:>' is equiv('infix:<') { ... }
-proto 'infix:>=' is equiv('infix:<') { ... }
-proto 'infix:<=' is equiv('infix:<') { ... }
-
-proto 'infix:<<' is equiv('infix:<') { ... }
-proto 'infix:>>' is equiv('infix:<') { ... }
-
-proto 'infix:+' is tighter('infix:<<') is pirop('n_add') { ... }
-proto 'infix:-' is equiv('infix:+') is pirop('n_sub') { ... }
-
-proto 'infix:*' is tighter('infix:+') is pirop('n_mul') { ... }
-proto 'infix:/' is equiv('infix:*') is pirop('n_div') { ... }
-proto 'infix:%' is equiv('infix:*') is pirop('n_mod') { ... }
-
-proto 'term:' is tighter('infix:*')
-              is parsed(&cast_expression) { ... }
-
-
-rule postfix_expression_prefix {
-    | <primary_expression> {*}                                  #= primary_expression
-    | '(' <type_name> ')' '{' <initializer_list> [',']? '}' {*} #= #type_name
-}
-
-rule postfix_expression {
-    <postfix_expression_prefix>
-    <postfix_expression_suffix>*
-    {*}
-}
-
-rule postfix_expression_suffix {
-    | <index> {*}                           #= index
-    | <arguments>  {*}                      #= arguments
-    | <direct_field> {*}                    #= direct_field
-    | <indirect_field> {*}                  #= indirect_field
-    | <inc_or_dec> {*}                      #= inc_or_dec
-}
-
-rule inc_or_dec {
-    $<op>=['++'|'--']
-    {*}
-}
-
-rule index {
-    '[' <expression> ']'
-    {*}
-}
-
-rule direct_field {
-    '.' <identifier>
-    {*}
-}
-
-rule indirect_field {
-    '->' <identifier>
-    {*}
-}
-
-rule arguments {
-    '(' <argument_expression_list>? ')'
-    {*}
-}
-
-rule argument_expression_list {
-    <assignment_expression> [',' <assignment_expression>]*
-    {*}
-}
-
-rule unary_expression {
-    | <postfix_expression> {*}              #= postfix_expression
-    | <prefix_expression> {*}               #= prefix_expression
-    | <unary_operator> <cast_expression> {*} #= unary_operator
-    | 'sizeof' <unary_expression>        {*} #= sizeof
-    | 'sizeof' '(' <type_name> ')'       {*} #= sizeof_type
-}
-
-rule prefix_expression {
-    $<op>=['++'|'--'] <unary_expression>
-    {*}
-}
-
-rule unary_operator {
-    '&' | '*' | '+' | '-' | '~' | '!'
-}
-
-rule cast_expression {
-    ['(' <type_name> ')']* <unary_expression>
-    {*}
-}
-
-rule primary_expression {
-    | <identifier> {*}             #= identifier
-    | <constant> {*}               #= constant
-    | <c_string_literal> {*}       #= c_string_literal
-    | '(' <expression> ')' {*}     #= expression
-}
-
-token ws {
-  [
-  | '//' \N* \n
-  | '/*' .*? '*/'
-  | \s+
-  | <.gcc_preprocess_id>
-  #| ^^ '#' \N \n
-  #| '#' \N* \n {*} #= origin
-  ]*
-}
-
-token gcc_preprocess_id {
-  ^^ '#' \s+ $<line>=[<.digit>+] \s+ <c_string_literal> $<ilist>=[ \s+ <.digit>+ ]* $$ {*} #= origin
-}

Deleted: trunk/compilers/ncigen/t/NCIGENAST/struct_00.t
==============================================================================
--- trunk/compilers/ncigen/t/NCIGENAST/struct_00.t	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,30 +0,0 @@
-#!perl
-# Copyright (C) 2008-2010, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use lib ('./lib', '../../lib');
-use Parrot::Test::NCIGENAST;
-
-plan tests => 1;
-ast(<<'CODE');
-typedef struct SPITupleTable
-{
-  MemoryContext tuptabcxt;  /* memory context of result table */
-  uint32    alloced;    /* # of alloced vals */
-  uint32    free;     /* # of free vals */
-  TupleDesc tupdesc;    /* tuple descriptor */
-  HeapTuple  *vals;     /* tuples */
-} SPITupleTable;
-CODE
-
-contains("<complex> => PMC 'NCIGENAST;Struct'");
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Deleted: trunk/compilers/ncigen/t/NCIGENAST/typedef_00.t
==============================================================================
--- trunk/compilers/ncigen/t/NCIGENAST/typedef_00.t	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,38 +0,0 @@
-#!perl
-# Copyright (C) 2008-2010, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use lib ('./lib', '../../lib');
-use Parrot::Test::NCIGENAST;
-
-plan tests => 10;
-ast('extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid);');
-SKIP: {
-skip("This feature is commented out");
-contains("Parent isCommit bool not defined");
-}
-
-ast('typedef void * void_pointer_type;');
-istypedef;
-ispointer;
-decl_ident_is("void_pointer_type");
-type_is("void");
-is_builtin;
-
-ast('typedef int a, b, c;');
-decl_ident_is("a");
-decl_ident_is("b");
-decl_ident_is("c");
-
-parse('int a(), b(), c()');
-parse_failure;
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Deleted: trunk/compilers/ncigen/t/harness
==============================================================================
--- trunk/compilers/ncigen/t/harness	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,7 +0,0 @@
-#!/usr/bin/perl
-
-# $Id$
-
-use FindBin;
-use lib qw( . lib ../lib ../../lib ../../lib );
-use Parrot::Test::Harness language => 'ncigen'

Deleted: trunk/compilers/ncigen/t/parse_00.t
==============================================================================
--- trunk/compilers/ncigen/t/parse_00.t	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,187 +0,0 @@
-#!perl
-# Copyright (C) 2008-2010, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use lib ('./lib', '../../lib');
-use Parrot::Test::NCIGENAST;
-
-plan tests => 20;
-
-parse_success(<<'CODE', '__extension__00.c');
-extern double strtod (__const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
-
-enum { MSG_OOB = 0x01 };
-__extension__ typedef signed long long int __int64_t;
-
-__extension__ typedef struct { int __val[2]; } __fsid_t;
-extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, __gnuc_va_list, int *__restrict);
-
-struct random_data
-{
-  int32_t rand_type;
-};
-
-struct _IO_FILE {
-char _unused2[15 * 6];
-char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
-};
-
-struct random_data
-{
-  int32_t rand_type;
-};
-
-int a = 8 - sizeof(int);
-char _unused2 = 15 + 6;
-int b = 12;
-int a = 10 * sizeof(int) * 13;
-int a = 8 * 3;
-typedef int Oid;
-int32_t Oid;
-int Oid;
-typedef unsigned int Oid;
-typedef union
-{
-  char __size[4];
-  int __align;
-} pthread_mutexattr_t;
-
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    int __kind;
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-
-  } __data;
-  char __size[24];
-  long int __align;
-} pthread_mutex_t;
-__extension__ typedef void * __timer_t;
-CODE
-
-parse_success(<<'CODE', '__attribute__.c');
-extern double strtod (__const char *__restrict __nptr, char **__restrict __endptr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) ;
-CODE
-
-parse_success(<<'CODE', 'enums.c');
-enum { MSG_OOB = 0x01 };
-CODE
-
-parse_success(<<'CODE', '__extension__01.c');
-__extension__ typedef signed long long int __int64_t;
-CODE
-
-parse_success(<<'CODE', '__extension__02.c');
-__extension__ typedef struct { int __val[2]; } __fsid_t;
-CODE
-
-parse_success(<<'CODE', 'gnu_va_arg.c');
-extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, __gnuc_va_list, int *__restrict);
-CODE
-
-parse_success(<<'CODE', 'int_32_t_declaration.c');
-struct random_data
-{
-  int32_t rand_type;
-};
-CODE
-
-parse_success(<<'CODE', 'struct_declaration_00.c');
-struct _IO_FILE {
-char _unused2[15 * 6];
-char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
-};
-CODE
-
-parse_success(<<'CODE', 'struct_declaration_01.c' );
-struct random_data
-{
-  int32_t rand_type;
-};
-CODE
-
-parse_success(<<'CODE', 'times_01.c');
-int a = 8 - sizeof(int);
-CODE
-
-parse_success(<<'CODE', 'times_02.c');
-char _unused2 = 15 + 6;
-CODE
-
-parse_success(<<'CODE', 'times_03.c');
-int b = 12;
-int a = 10 * sizeof(int) * 13;
-CODE
-
-parse_success(<<'CODE', 'times_04.c');
-int a = 8 * 3;
-CODE
-
-parse_success(<<'CODE', 'typedef_01.c');
-typedef int Oid;
-CODE
-
-parse_success(<<'CODE', 'typedef_02.c');
-int32_t Oid;
-CODE
-
-parse_success(<<'CODE', 'typedef_03.c');
-int Oid;
-CODE
-
-parse_success(<<'CODE', 'typedef.c');
-typedef unsigned int Oid;
-CODE
-
-parse_success(<<'CODE', 'typedef_union_00.c');
-typedef union
-{
-  char __size[4];
-  int __align;
-} pthread_mutexattr_t;
-CODE
-
-parse_success(<<'CODE', 'typedef_union_01.c');
-typedef union
-{
-  struct __pthread_mutex_s
-  {
-    int __lock;
-    unsigned int __count;
-    int __owner;
-    int __kind;
-    unsigned int __nusers;
-    __extension__ union
-    {
-      int __spins;
-      __pthread_slist_t __list;
-    };
-
-  } __data;
-  char __size[24];
-  long int __align;
-} pthread_mutex_t;
-CODE
-
-parse_success(<<'CODE', 'void_star.c');
-__extension__ typedef void * __timer_t;
-CODE
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Deleted: trunk/compilers/ncigen/t/parse_01.t
==============================================================================
--- trunk/compilers/ncigen/t/parse_01.t	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,40 +0,0 @@
-#!perl
-# Copyright (C) 2008-2010, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use lib ('./lib', '../../lib');
-use Parrot::Test::NCIGENAST;
-
-plan tests => 5;
-
-parse_success(<<'CODE', 'typedef.c');
-typedef int (*sqlite3_callbackkk)(void*,int,char*, char*);
-CODE
-
-parse_success(<<'CODE', 'typedef.c');
-int sqlite3_callbackk(void*,int,char*, char*);
-CODE
-
-parse_success(<<'CODE', 'typedef.c');
-typedef int (*sqlite3_callback)(void*,int,char**, char**);
-CODE
-
-parse_success(<<'CODE', 'typedef.c');
-typedef struct sqlite3 sqlite3;
-CODE
-
-parse_success(<<'CODE', 'typedefstartstar.c');
-typedef struct sqlite3 sqlite3;
-int sqlite3_open( const char *filename, sqlite3 **ppDb);
-CODE
-
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Deleted: trunk/compilers/ncigen/t/parse_02.t
==============================================================================
--- trunk/compilers/ncigen/t/parse_02.t	Sat Apr 24 02:42:02 2010	(r45956)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,84 +0,0 @@
-#!perl
-# Copyright (C) 2008-2010, Parrot Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use lib ('./lib', '../../lib');
-use Parrot::Test::NCIGENAST;
-
-plan tests => 2;
-
-parse_success(<<'CODE', 'Xlib.h');
-typedef struct
-
-
-
-{
- XExtData *ext_data;
- struct _XPrivate *private1;
- int fd;
- int private2;
- int proto_major_version;
- int proto_minor_version;
- char *vendor;
-        XID private3;
- XID private4;
- XID private5;
- int private6;
- XID (*resource_alloc)(
-  struct _XDisplay*
- );
- int byte_order;
- int bitmap_unit;
- int bitmap_pad;
- int bitmap_bit_order;
- int nformats;
- ScreenFormat *pixmap_format;
- int private8;
- int release;
- struct _XPrivate *private9, *private10;
- int qlen;
- unsigned long last_request_read;
- unsigned long request;
- XPointer private11;
- XPointer private12;
- XPointer private13;
- XPointer private14;
- unsigned max_request_size;
- struct _XrmHashBucketRec *db;
- int (*private15)(
-  struct _XDisplay*
-  );
- char *display_name;
- int default_screen;
- int nscreens;
- Screen *screens;
- unsigned long motion_buffer;
- unsigned long private16;
- int min_keycode;
- int max_keycode;
- XPointer private17;
- XPointer private18;
- int private19;
- char *xdefaults;
-
-}
-
-
-
-*_XPrivDisplay;
-CODE
-
-
-parse_success(<<'CODE', 'Xlib.h 2');
-extern int (*XSetAfterFunction( Display* , int (*) ( Display*)))( Display*);
-CODE
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Modified: trunk/config/gen/makefiles.pm
==============================================================================
--- trunk/config/gen/makefiles.pm	Sat Apr 24 02:38:23 2010	(r45956)
+++ trunk/config/gen/makefiles.pm	Sat Apr 24 02:42:02 2010	(r45957)
@@ -48,8 +48,6 @@
             conditioned_lines => 1,
         },
 
-        'compilers/ncigen/Makefile'  =>
-            { SOURCE => 'compilers/ncigen/config/makefiles/ncigen.in' },
         'src/dynpmc/Makefile'        =>
             { SOURCE => 'config/gen/makefiles/dynpmc.in' },
         'editor/Makefile'            =>

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Sat Apr 24 02:38:23 2010	(r45956)
+++ trunk/config/gen/makefiles/root.in	Sat Apr 24 02:42:02 2010	(r45957)
@@ -139,7 +139,6 @@
 GEN_MAKEFILES = \
     Makefile \
     docs/Makefile \
-    compilers/ncigen/Makefile \
     editor/Makefile \
     ext/Makefile \
     src/dynoplibs/Rules.mak \


More information about the parrot-commits mailing list