Author: tewk
Date: Wed Nov 26 07:39:07 2008
New Revision: 33223
Added:
trunk/compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm (contents, props
changed)
- copied, changed from r33216,
/trunk/compilers/ncigen/lib/Parrot/Test/C99AST.pm
trunk/compilers/ncigen/ncigen.pir (contents, props changed)
- copied, changed from r33216, /trunk/compilers/ncigen/c99.pir
trunk/compilers/ncigen/ncigen.pl (contents, props changed)
- copied, changed from r33216, /trunk/compilers/ncigen/nci_gen.pl
trunk/compilers/ncigen/src/NCIGENAST.pir (contents, props changed)
- copied, changed from r33216, /trunk/compilers/ncigen/src/c99AST.pir
trunk/compilers/ncigen/t/NCIGENAST/ (props changed)
- copied from r33216, /trunk/compilers/ncigen/t/c99AST/
Removed:
trunk/compilers/ncigen/c99.pir
trunk/compilers/ncigen/lib/Parrot/Test/C99AST.pm
trunk/compilers/ncigen/nci_gen.pl
trunk/compilers/ncigen/src/c99.pg
trunk/compilers/ncigen/src/c99AST.pir
trunk/compilers/ncigen/t/c99AST/
Modified:
trunk/compilers/ncigen/ (props changed)
trunk/compilers/ncigen/config/makefiles/ncigen.in
trunk/compilers/ncigen/src/NCIPIR.pir
trunk/compilers/ncigen/src/parser/actions.pm
trunk/compilers/ncigen/t/NCIGENAST/struct_00.t
trunk/compilers/ncigen/t/NCIGENAST/typedef_00.t
trunk/compilers/ncigen/t/parse_00.t
trunk/compilers/ncigen/t/parse_01.t
trunk/compilers/ncigen/t/parse_02.t
Log:
[NCIGEN] get rid of all the c99 references except the Grammar itself
Modified: trunk/compilers/ncigen/config/makefiles/ncigen.in
==============================================================================
--- trunk/compilers/ncigen/config/makefiles/ncigen.in (original)
+++ trunk/compilers/ncigen/config/makefiles/ncigen.in Wed Nov 26 07:39:07 2008
@@ -27,15 +27,15 @@
PMC_DIR = src/pmc
-all: c99.pbc
+all: ncigen.pbc
C_GROUP = $(PMC_DIR)/c_group$(LOAD_EXT)
-SOURCES = c99.pir \
+SOURCES = ncigen.pir \
src/gen_grammar.pir \
src/gen_actions.pir \
src/gen_builtins.pir \
- src/c99AST.pir \
+ src/NCIGENAST.pir \
src/NCIPIR.pir \
# $(C_GROUP)
@@ -46,8 +46,8 @@
# PMC_SOURCES = $(PMC_DIR)/c.pmc
# the default target
-c99.pbc: $(PARROT) $(SOURCES)
- $(PARROT) $(PARROT_ARGS) -o c99.pbc c99.pir
+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) \
@@ -72,7 +72,7 @@
@echo ""
@echo "Following targets are available for the user:"
@echo ""
- @echo " all: c.pbc"
+ @echo " all: ncigen.pbc"
@echo " This is the default."
@echo "Testing:"
@echo " test: Run the test suite."
@@ -94,7 +94,7 @@
testclean:
CLEANUPS = \
- c99.pbc \
+ ncigen.pbc \
src/gen_grammar.pir \
src/gen_actions.pir \
src/gen_builtins.pir \
Copied: trunk/compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm (from r33216,
/trunk/compilers/ncigen/lib/Parrot/Test/C99AST.pm)
==============================================================================
--- /trunk/compilers/ncigen/lib/Parrot/Test/C99AST.pm (original)
+++ trunk/compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm Wed Nov 26 07:39:07 2008
@@ -1,7 +1,7 @@
# $Id$
# Copyright (C) 2006-2008, The Perl Foundation.
-package Parrot::Test::C99AST;
+package Parrot::Test::NCIGENAST;
use strict;
@@ -79,7 +79,7 @@
}
sub istypedef {
- return like( qr/c99AST;TypeDef/, @_);
+ return like( qr/NCIGENAST;TypeDef/, @_);
}
sub ispointer {
return like( qr/<pointer> => 1/, @_);
@@ -113,7 +113,7 @@
}
sub ncigenit {
- my ( $self, $code, $c99args ) = @_;
+ my ( $self, $code, $ncigenargs ) = @_;
my $count = $self->{builder}->current_test + 1;
my $parrotdir = dirname $self->{parrot};
@@ -125,7 +125,7 @@
my $args = $ENV{TEST_PROG_ARGS} || '';
- my $cmd = "$self->{parrot} $args $parrotdir/compilers/ncigen/c99.pbc
$c99args $lang_f";
+ my $cmd = "$self->{parrot} $args
$parrotdir/compilers/ncigen/ncigen.pbc $ncigenargs $lang_f";
my $exit_code = Parrot::Test::run_command(
$cmd,
CD => $self->{relpath},
@@ -147,7 +147,7 @@
my ( $self, $method, $code, $cmd, $output, $exit_code, $count, $expected,
$desc ) = @_;
#print "$cmd, $exit_code, $count, $expected, $desc \n";
- $desc = "C99AST Test $count" unless $desc;
+ $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;
Copied: trunk/compilers/ncigen/ncigen.pir (from r33216,
/trunk/compilers/ncigen/c99.pir)
==============================================================================
--- /trunk/compilers/ncigen/c99.pir (original)
+++ trunk/compilers/ncigen/ncigen.pir Wed Nov 26 07:39:07 2008
@@ -3,15 +3,15 @@
=head1 TITLE
-c99.pir - A C99 compiler.
+ncigen.pir - A NCI stub compiler.
=head2 Description
-This is the base file for the C99 compiler.
+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 'C99'.
+and registers the compiler under the name 'NCIGEN'.
=head2 Functions
@@ -24,18 +24,18 @@
=cut
-.namespace [ 'C99';'Compiler' ]
+.namespace [ 'NCIGEN';'Compiler' ]
-.loadlib 'c99_group'
+.loadlib 'ncigen_group'
.sub 'onload' :anon :load :init
load_bytecode 'PCT.pbc'
$P0 = get_hll_global ['PCT'], 'HLLCompiler'
$P1 = $P0.'new'()
- $P1.'language'('C99')
+ $P1.'language'('NCIGEN')
$P1.'parsegrammar'('C99::Grammar')
- $P1.'parseactions'('C99::Grammar::Actions')
+ $P1.'parseactions'('NCIGEN::Grammar::Actions')
.end
=item main(args :slurpy) :main
@@ -48,7 +48,7 @@
.sub 'main' :main
.param pmc args
- $P0 = compreg 'C99'
+ $P0 = compreg 'NCIGEN'
$P1 = split ' ', 'parse nci_ast gen_nci_pir'
setattribute $P0, '@stages', $P1
$P1 = 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'
@@ -87,13 +87,13 @@
.local pmc ast
ast = source.'item'()
pop_eh
- $I0 = isa ast, ['c99AST';'Decls']
+ $I0 = isa ast, ['NCIGENAST';'Decls']
unless $I0 goto err_past
.return (ast)
err_past:
$S0 = typeof source
- .tailcall self.'panic'('Unable to obtain c99AST from ', $S0)
+ .tailcall self.'panic'('Unable to obtain NCIGENAST from ', $S0)
.end
.sub 'gen_nci_pir' :method
@@ -107,7 +107,7 @@
.end
-.include 'src/c99AST.pir'
+.include 'src/NCIGENAST.pir'
.include 'src/NCIPIR.pir'
.include 'src/gen_builtins.pir'
.include 'src/gen_grammar.pir'
Copied: trunk/compilers/ncigen/ncigen.pl (from r33216,
/trunk/compilers/ncigen/nci_gen.pl)
==============================================================================
--- /trunk/compilers/ncigen/nci_gen.pl (original)
+++ trunk/compilers/ncigen/ncigen.pl Wed Nov 26 07:39:07 2008
@@ -39,7 +39,7 @@
sub gen_NCI_signatures {
my ( $file, $more_args ) = @_;
- return execit("make; $PARROT c99.pbc $more_args $file");
+ return execit("make; $PARROT ncigen.pbc $more_args $file");
}
sub execit {
Copied: trunk/compilers/ncigen/src/NCIGENAST.pir (from r33216,
/trunk/compilers/ncigen/src/c99AST.pir)
==============================================================================
--- /trunk/compilers/ncigen/src/c99AST.pir (original)
+++ trunk/compilers/ncigen/src/NCIGENAST.pir Wed Nov 26 07:39:07 2008
@@ -1,52 +1,52 @@
=head1 NAME
-c99AST - c99 abstract syntax tree
+NCIGENAST - NCIGEN abstract syntax tree
=head1 DESCRIPTION
This file implements the various abstract syntax tree nodes
-for compiling c99 programs.
+for doing syntax analysis on c99 programs.
=cut
-.namespace [ 'c99AST';'Node' ]
+.namespace [ 'NCIGENAST';'Node' ]
.sub 'onload' :anon :load :init
- ## create the c99AST::Node base class
+ ## create the NCIGENAST::Node base class
.local pmc p6meta, base, vardecl
p6meta = new 'P6metaclass'
- base = p6meta.'new_class'('c99AST::Node', 'parent'=>'PCT::Node')
+ base = p6meta.'new_class'('NCIGENAST::Node', 'parent'=>'PCT::Node')
- vardecl = p6meta.'new_class'('c99AST::VarDecl', 'parent'=>base)
- p6meta.'new_class'('c99AST::Decls', 'parent'=>base)
+ vardecl = p6meta.'new_class'('NCIGENAST::VarDecl', 'parent'=>base)
+ p6meta.'new_class'('NCIGENAST::Decls', 'parent'=>base)
- p6meta.'new_class'('c99AST::TypeDef', 'parent'=>vardecl)
- p6meta.'new_class'('c99AST::FuncDecl', 'parent'=>vardecl)
- p6meta.'new_class'('c99AST::Param', 'parent'=>vardecl)
- p6meta.'new_class'('c99AST::Struct', 'parent'=>vardecl)
- p6meta.'new_class'('c99AST::Union', 'parent'=>vardecl)
+ 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
-=head1 c99AST Node types
+=head1 NCIGENAST Node types
-=head2 c99AST::Node
+=head2 NCIGENAST::Node
-C<c99AST::Node> is the base class for all c99AST nodes, and is
+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 c99AST node inherits C<name>, C<source>, and C<pos> attributes
+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<c99AST::Node>.
+Other node attributes are generally defined by subclasses of
C<NCIGENAST::Node>.
=over 4
@@ -106,9 +106,9 @@
=back
-=head2 c99AST::TypeDef
+=head2 NCIGENAST::TypeDef
-C<c99AST::Val> nodes represent constant values in the abstract
+C<NCIGENAST::Val> nodes represent constant values in the abstract
syntax tree. The C<name> attribute represents the value of the
node.
@@ -120,7 +120,7 @@
=cut
-.namespace [ 'c99AST';'TypeDef' ]
+.namespace [ 'NCIGENAST';'TypeDef' ]
.sub 'value' :method
.param pmc value :optional
@@ -130,9 +130,9 @@
=back
-=head2 c99AST::Var
+=head2 NCIGENAST::Var
-C<c99AST::Var> nodes represent variables within the abstract
+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.
@@ -140,14 +140,14 @@
=item scope([value])
-Get/set the c99AST::Var node's "scope" (i.e., how the variable
+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 [ 'c99AST';'VarDecl' ]
+.namespace [ 'NCIGENAST';'VarDecl' ]
.sub 'type' :method
.param pmc value :optional
@@ -263,7 +263,7 @@
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 c99AST tree to create the value.
+implementation) a NCIGENAST tree to create the value.
=cut
@@ -291,9 +291,9 @@
=back
-=head2 c99AST::Op
+=head2 NCIGENAST::Op
-C<c99AST::Op> nodes represent the operations in an abstract syntax
+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.
Modified: trunk/compilers/ncigen/src/NCIPIR.pir
==============================================================================
--- trunk/compilers/ncigen/src/NCIPIR.pir (original)
+++ trunk/compilers/ncigen/src/NCIPIR.pir Wed Nov 26 07:39:07 2008
@@ -1,10 +1,10 @@
=head1 NAME
-NCIPIR::Compiler - NCI PIR Compiler for c99AST trees.
+NCIPIR::Compiler - NCI PIR Compiler for NCIGENAST trees.
=head1 DESCRIPTION
-NCIPIR::Compiler defines a compiler that converts a c99AST tree into PIR
+NCIPIR::Compiler defines a compiler that converts a NCIGENAST tree into PIR
=head1 METHODS
@@ -41,9 +41,9 @@
newself.'code'(code)
## if the root node isn't a Sub, wrap it
- $I0 = isa ast, ['c99AST';'Decls']
+ $I0 = isa ast, ['NCIGENAST';'Decls']
if $I0 goto have_sub
- $P0 = get_hll_global ['c99AST'], 'Decls'
+ $P0 = get_hll_global ['NCIGENAST'], 'Decls'
ast = $P0.'new'(ast, 'name'=>'anon')
have_sub:
@@ -172,7 +172,7 @@
=cut
-.sub 'pir' :method :multi(_,['c99AST';'FuncDecl'])
+.sub 'pir' :method :multi(_,['NCIGENAST';'FuncDecl'])
.param pmc node
## get list of arguments to operation
@@ -290,7 +290,7 @@
=cut
-.sub 'pir' :method :multi(_, ['c99AST';'TypeDef'])
+.sub 'pir' :method :multi(_, ['NCIGENAST';'TypeDef'])
.param pmc node
.return ('')
.tailcall pir_dump(node)
@@ -302,7 +302,7 @@
=cut
-.sub 'pir' :method :multi(_, ['c99AST';'VarDecl'])
+.sub 'pir' :method :multi(_, ['NCIGENAST';'VarDecl'])
.param pmc node
.return ('')
.tailcall pir_dump(node)
Modified: trunk/compilers/ncigen/src/parser/actions.pm
==============================================================================
--- trunk/compilers/ncigen/src/parser/actions.pm (original)
+++ trunk/compilers/ncigen/src/parser/actions.pm Wed Nov 26 07:39:07 2008
@@ -3,7 +3,7 @@
=begin comments
-C99::Grammar::Actions - ast transformations for C99
+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.
@@ -16,13 +16,13 @@
=end comments
-class C99::Grammar::Actions;
+class NCIGEN::Grammar::Actions;
-our $decls := c99AST::Decls.new();
-our $C99DEBUG :=0;
+our $decls := NCIGENAST::Decls.new();
+our $NCIGENDEBUG :=0;
method TOP($/) {
- if $C99DEBUG { _dumper($decls); }
+ if $NCIGENDEBUG { _dumper($decls); }
make $decls;
}
@@ -44,7 +44,7 @@
}
method declaration($/) {
- my $ast := c99AST::VarDecl.new( :node($/) );
+ my $ast := NCIGENAST::VarDecl.new( :node($/) );
my $type := "";
#say("=================================================================================================");
@@ -53,19 +53,19 @@
# return 1;
my $decl_specs :=
$<declaration_specifiers><repeatable_declaration_specifiers>;
if typedef($decl_specs) {
- $ast := c99AST::TypeDef.new( :node($/) );
+ $ast := NCIGENAST::TypeDef.new( :node($/) );
$type := "TypeDef";
}
elsif
$/<init_declarator><init_declarator><declarator><direct_declarator><declarator_suffix><declarator_suffix><parameter_type_list>
{
- $ast := c99AST::FuncDecl.new( :node($/) );
+ $ast := NCIGENAST::FuncDecl.new( :node($/) );
$type := "FuncDecl";
}
# elsif $<declaration_specifiers><type_specifier><type> {
-# $ast := c99AST::Struct.new( :node($/) );
+# $ast := NCIGENAST::Struct.new( :node($/) );
# $type := "Struct";
# }
else {
- $ast := c99AST::VarDecl.new( :node($/) );
+ $ast := NCIGENAST::VarDecl.new( :node($/) );
$type := "VarDecl";
}
parse_decl_specs(
$<declaration_specifiers><repeatable_declaration_specifiers>, $ast );
@@ -81,7 +81,7 @@
#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 := c99AST::Param.new( :node( $_ ) );
+ my $param := NCIGENAST::Param.new( :node( $_ ) );
settype($_<declaration_specifiers><type_specifier>, $param);
my $param_ident := $_<declarator>;
@@ -93,7 +93,7 @@
my $name := setname($declarator, $ast);
$decls{ $name } := $ast;
ispointer($declarator, $ast);
- #if $C99DEBUG { _dumper($ast); }
+ #if $NCIGENDEBUG { _dumper($ast); }
#say($name);
}
#elsif ($type eq "VarDecl") {
@@ -105,7 +105,7 @@
my $name := setname($_, $l_ast);
$decls{ $name } := $l_ast;
ispointer($_, $l_ast);
- #if $C99DEBUG { _dumper($l_ast); }
+ #if $NCIGENDEBUG { _dumper($l_ast); }
#say($name);
}
}
@@ -195,10 +195,10 @@
if $s_or_u {
my $su;
if ($struct_or_union eq "struct" ) {
- $su := c99AST::Struct.new( :node($/) );
+ $su := NCIGENAST::Struct.new( :node($/) );
}
else {
- $su := c99AST::Union.new( :node($/) );
+ $su := NCIGENAST::Union.new( :node($/) );
}
$su.name($ident);
build_struct_or_union($s_or_u, $su);
@@ -223,7 +223,7 @@
sub build_struct_or_union($/, $ast) {
for $/ {
- my $smt := c99AST::VarDecl.new( :node($_) );
+ my $smt := NCIGENAST::VarDecl.new( :node($_) );
settype( $_<specifier_qualifier_list><type_specifier>, $smt );
for $_<struct_declarator_list> {
my $sm := $smt.clone();
Modified: trunk/compilers/ncigen/t/NCIGENAST/struct_00.t
==============================================================================
--- /trunk/compilers/ncigen/t/c99AST/struct_00.t (original)
+++ trunk/compilers/ncigen/t/NCIGENAST/struct_00.t Wed Nov 26 07:39:07 2008
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use lib ('./lib', '../../lib');
-use Parrot::Test::C99AST;
+use Parrot::Test::NCIGENAST;
plan tests => 1;
ast(<<'CODE');
@@ -15,4 +15,4 @@
} SPITupleTable;
CODE
-contains("<complex> => PMC 'c99AST;Struct'");
+contains("<complex> => PMC 'NCIGENAST;Struct'");
Modified: trunk/compilers/ncigen/t/NCIGENAST/typedef_00.t
==============================================================================
--- /trunk/compilers/ncigen/t/c99AST/typedef_00.t (original)
+++ trunk/compilers/ncigen/t/NCIGENAST/typedef_00.t Wed Nov 26 07:39:07 2008
@@ -1,11 +1,14 @@
#!/usr/bin/perl
use lib ('./lib', '../../lib');
-use Parrot::Test::C99AST;
+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;
Modified: trunk/compilers/ncigen/t/parse_00.t
==============================================================================
--- trunk/compilers/ncigen/t/parse_00.t (original)
+++ trunk/compilers/ncigen/t/parse_00.t Wed Nov 26 07:39:07 2008
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use lib ('./lib', '../../lib');
-use Parrot::Test::C99AST;
+use Parrot::Test::NCIGENAST;
plan tests => 20;
Modified: trunk/compilers/ncigen/t/parse_01.t
==============================================================================
--- trunk/compilers/ncigen/t/parse_01.t (original)
+++ trunk/compilers/ncigen/t/parse_01.t Wed Nov 26 07:39:07 2008
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use lib ('./lib', '../../lib');
-use Parrot::Test::C99AST;
+use Parrot::Test::NCIGENAST;
plan tests => 5;
Modified: trunk/compilers/ncigen/t/parse_02.t
==============================================================================
--- trunk/compilers/ncigen/t/parse_02.t (original)
+++ trunk/compilers/ncigen/t/parse_02.t Wed Nov 26 07:39:07 2008
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use lib ('./lib', '../../lib');
-use Parrot::Test::C99AST;
+use Parrot::Test::NCIGENAST;
plan tests => 2;