Author: bernhard
Date: Sat Mar 29 04:16:42 2008
New Revision: 26620

Added:
   trunk/languages/hq9plus/   (props changed)
   trunk/languages/hq9plus/MAINTAINER
      - copied unchanged from r26569, /trunk/languages/HQ9plus/MAINTAINER
   trunk/languages/hq9plus/README
      - copied, changed from r26569, /trunk/languages/HQ9plus/README
   trunk/languages/hq9plus/config/
   trunk/languages/hq9plus/config/makefiles/
   trunk/languages/hq9plus/config/makefiles/root.in   (contents, props changed)
   trunk/languages/hq9plus/hq9plus.pir   (contents, props changed)
   trunk/languages/hq9plus/lib/
      - copied from r26569, /trunk/languages/HQ9plus/lib/
   trunk/languages/hq9plus/lib/Parrot/
      - copied from r26619, /trunk/languages/HQ9plus/lib/Parrot/
   trunk/languages/hq9plus/lib/Parrot/Test/Hq9plus.pm   (contents, props 
changed)
   trunk/languages/hq9plus/src/   (props changed)
   trunk/languages/hq9plus/src/builtins/
   trunk/languages/hq9plus/src/builtins/hello.pir   (contents, props changed)
   trunk/languages/hq9plus/src/builtins/nintynine_bottles_of_beer.pir   
(contents, props changed)
   trunk/languages/hq9plus/src/builtins/plus.pir   (contents, props changed)
   trunk/languages/hq9plus/src/builtins/quine.pir   (contents, props changed)
   trunk/languages/hq9plus/src/parser/
   trunk/languages/hq9plus/src/parser/actions.pm   (contents, props changed)
   trunk/languages/hq9plus/src/parser/grammar.pg   (contents, props changed)
   trunk/languages/hq9plus/t/   (props changed)
   trunk/languages/hq9plus/t/basic.t
      - copied, changed from r26569, /trunk/languages/HQ9plus/t/basic.t
   trunk/languages/hq9plus/t/harness   (contents, props changed)
Modified:
   trunk/MANIFEST
   trunk/MANIFEST.SKIP
   trunk/config/gen/languages.pm
   trunk/languages/LANGUAGES_STATUS.pod
   trunk/languages/hq9plus/lib/Parrot/Test/HQ9plus.pm
   trunk/languages/perl6/src/classes/IO.pir   (contents, props changed)
   trunk/languages/t/harness

Log:
[HQ9+]
Reimplement with PCT.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Sat Mar 29 04:16:42 2008
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Mar 28 20:41:52 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Mar 29 10:07:19 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -1382,6 +1382,19 @@
 languages/forth/variablestack.pir                           [forth]
 languages/forth/virtualstack.pir                            [forth]
 languages/forth/words.pir                                   [forth]
+languages/hq9plus/MAINTAINER                                [hq9plus]
+languages/hq9plus/README                                    [hq9plus]
+languages/hq9plus/config/makefiles/root.in                  [hq9plus]
+languages/hq9plus/hq9plus.pir                               [hq9plus]
+languages/hq9plus/lib/Parrot/Test/Hq9plus.pm                [hq9plus]
+languages/hq9plus/src/builtins/hello.pir                    [hq9plus]
+languages/hq9plus/src/builtins/nintynine_bottles_of_beer.pir [hq9plus]
+languages/hq9plus/src/builtins/plus.pir                     [hq9plus]
+languages/hq9plus/src/builtins/quine.pir                    [hq9plus]
+languages/hq9plus/src/parser/actions.pm                     [hq9plus]
+languages/hq9plus/src/parser/grammar.pg                     [hq9plus]
+languages/hq9plus/t/basic.t                                 [hq9plus]
+languages/hq9plus/t/harness                                 [hq9plus]
 languages/jako/Curses.jako                                  [jako]
 languages/jako/MAINTAINER                                   [jako]
 languages/jako/README                                       [jako]
@@ -1828,6 +1841,7 @@
 languages/perl6/src/classes/Bool.pir                        [perl6]
 languages/perl6/src/classes/Code.pir                        [perl6]
 languages/perl6/src/classes/Hash.pir                        [perl6]
+languages/perl6/src/classes/IO.pir                          [perl6]
 languages/perl6/src/classes/Int.pir                         [perl6]
 languages/perl6/src/classes/Junction.pir                    [perl6]
 languages/perl6/src/classes/List.pir                        [perl6]

Modified: trunk/MANIFEST.SKIP
==============================================================================
--- trunk/MANIFEST.SKIP (original)
+++ trunk/MANIFEST.SKIP Sat Mar 29 04:16:42 2008
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Mar 18 12:19:53 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Mar 29 10:06:15 2008 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
@@ -727,6 +727,23 @@
 ^languages/forth/variablestack\.pbc/
 ^languages/forth/virtualstack\.pbc$
 ^languages/forth/virtualstack\.pbc/
+# generated from svn:ignore of 'languages/hq9plus/'
+^languages/hq9plus/Makefile$
+^languages/hq9plus/Makefile/
+^languages/hq9plus/hq9plus\.pbc$
+^languages/hq9plus/hq9plus\.pbc/
+# generated from svn:ignore of 'languages/hq9plus/src/'
+^languages/hq9plus/src/gen_actions\.pir$
+^languages/hq9plus/src/gen_actions\.pir/
+^languages/hq9plus/src/gen_builtins\.pir$
+^languages/hq9plus/src/gen_builtins\.pir/
+^languages/hq9plus/src/gen_grammar\.pir$
+^languages/hq9plus/src/gen_grammar\.pir/
+# generated from svn:ignore of 'languages/hq9plus/t/'
+^languages/hq9plus/t/.*\.HQ9plus$
+^languages/hq9plus/t/.*\.HQ9plus/
+^languages/hq9plus/t/.*\.out$
+^languages/hq9plus/t/.*\.out/
 # generated from svn:ignore of 'languages/jako/'
 ^languages/jako/.*\.list$
 ^languages/jako/.*\.list/

Modified: trunk/config/gen/languages.pm
==============================================================================
--- trunk/config/gen/languages.pm       (original)
+++ trunk/config/gen/languages.pm       Sat Mar 29 04:16:42 2008
@@ -52,7 +52,7 @@
         cardinal c99 cola
         eclectus ecmascript
         forth
-        HQ9plus jako
+        hq9plus jako
         lisp lolcode lua
         m4
         ook

Modified: trunk/languages/LANGUAGES_STATUS.pod
==============================================================================
--- trunk/languages/LANGUAGES_STATUS.pod        (original)
+++ trunk/languages/LANGUAGES_STATUS.pod        Sat Mar 29 04:16:42 2008
@@ -390,7 +390,7 @@
 =back
 
 
-=head2 HQ9plus
+=head2 HQ9+
 
 =over 4
 
@@ -401,6 +401,7 @@
 =item Status
 
 Works and is mostly complete.
+Based on PCT.
 
 =item Last verified with parrot version
 
@@ -408,7 +409,7 @@
 
 =item Location
 
-C<languages/HQ9plus>
+C<languages/hq9plus>
 
 =back
 

Copied: trunk/languages/hq9plus/README (from r26569, 
/trunk/languages/HQ9plus/README)
==============================================================================
--- /trunk/languages/HQ9plus/README     (original)
+++ trunk/languages/hq9plus/README      Sat Mar 29 04:16:42 2008
@@ -1,3 +1,7 @@
 $Id$
 
-See 'perldoc HQ9plus.pir'
+HQ9plus is a non turing-complete language.
+Type 'make test' and take a look at the test scripts in 't'.
+
+See http://en.wikipedia.org/wiki/HQ9+ and
+http://www.esolangs.org/wiki/HQ9_Plus for details.

Added: trunk/languages/hq9plus/config/makefiles/root.in
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/config/makefiles/root.in    Sat Mar 29 04:16:42 2008
@@ -0,0 +1,126 @@
+## $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        = ../../[EMAIL PROTECTED]@
+CAT           = $(PERL) -MExtUtils::Command -e cat
+BUILD_DYNPMC  = $(PERL) $(BUILD_DIR)/tools/build/dynpmc.pl
+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: hq9plus.pbc
+
+HQ9PLUS_GROUP = $(PMC_DIR)/hq9plus_group$(LOAD_EXT)
+
+SOURCES = hq9plus.pir \
+  src/gen_grammar.pir \
+  src/gen_actions.pir \
+  src/gen_builtins.pir \
+#  $(HQ9PLUS_GROUP)
+
+BUILTINS_PIR = \
+  src/builtins/hello.pir \
+  src/builtins/quine.pir \
+  src/builtins/nintynine_bottles_of_beer.pir \
+  src/builtins/plus.pir \
+
+# PMCS = hq9plus
+# PMC_SOURCES = $(PMC_DIR)/hq9plus.pmc
+
+# the default target
+hq9plus.pbc: $(PARROT) $(SOURCES)
+       $(PARROT) $(PARROT_ARGS) -o hq9plus.pbc hq9plus.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
+
+$(HQ9PLUS_GROUP): $(PARROT) $(PMC_SOURCES)
+       cd $(PMC_DIR) && $(BUILD_DYNPMC) generate $(PMCS)
+       cd $(PMC_DIR) && $(BUILD_DYNPMC) compile $(PMCS)
+       cd $(PMC_DIR) && $(BUILD_DYNPMC) linklibs $(PMCS)
+       cd $(PMC_DIR) && $(BUILD_DYNPMC) copy --destination=$(PARROT_DYNEXT) 
$(PMCS)
+
+# regenerate the Makefile
+Makefile: config/makefiles/root.in
+       cd $(BUILD_DIR) && $(RECONFIGURE) --step=gen::languages 
--languages=hq9plus
+
+# 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:               hq9plus.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 = \
+  hq9plus.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
+
+

Added: trunk/languages/hq9plus/hq9plus.pir
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/hq9plus.pir Sat Mar 29 04:16:42 2008
@@ -0,0 +1,82 @@
+=head1 TITLE
+
+hq9plus.pir - A HQ9plus compiler.
+
+=head2 Description
+
+This is the base file for the HQ9plus 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 'HQ9plus'.
+
+=head2 Functions
+
+=over 4
+
+=item onload()
+
+Creates the HQ9plus compiler using a C<PCT::HLLCompiler>
+object.
+
+=cut
+
+.namespace [ 'HQ9plus::Compiler' ]
+
+.loadlib 'hq9plus_group'
+
+.sub 'onload' :anon :load :init
+    load_bytecode 'PCT.pbc'
+
+    $P0 = get_hll_global ['PCT'], 'HLLCompiler'
+    $P1 = $P0.'new'()
+    $P1.'language'('HQ9plus')
+    $P1.'parsegrammar'('HQ9plus::Grammar')
+    $P1.'parseactions'('HQ9plus::Grammar::Actions')
+.end
+
+=item main(args :slurpy)  :main
+
+Start compilation by passing any command line C<args>
+to the HQ9plus compiler.
+
+=cut
+
+.sub 'main' :main
+    .param pmc args
+
+    # we need the code the 'quine'
+    .local string code_fn
+    code_fn = args[1]
+    .local pmc pio
+    pio = new 'ParrotIO'
+    .local pmc code_string
+    code_string = new 'String'
+    code_string = pio.slurp( code_fn )
+    .lex "$code_string", code_string
+
+    # needed for 'plus'
+    .local pmc accumulator
+    accumulator = new 'Integer'
+    accumulator = 0
+    .lex "$accumulator", accumulator
+
+    $P0 = compreg 'HQ9plus'
+    $P1 = $P0.'command_line'(args)
+.end
+
+
+.include 'src/gen_builtins.pir'
+.include 'src/gen_grammar.pir'
+.include 'src/gen_actions.pir'
+
+=back
+
+=cut
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

Modified: trunk/languages/hq9plus/lib/Parrot/Test/HQ9plus.pm
==============================================================================
--- /trunk/languages/HQ9plus/lib/Parrot/Test/HQ9plus.pm (original)
+++ trunk/languages/hq9plus/lib/Parrot/Test/HQ9plus.pm  Sat Mar 29 04:16:42 2008
@@ -1,6 +1,5 @@
 # $Id$
-
-# Copyright (C) 2005-2007, The Perl Foundation.
+# Copyright (C) 2005-2008, The Perl Foundation.
 
 package Parrot::Test::HQ9plus;
 

Added: trunk/languages/hq9plus/lib/Parrot/Test/Hq9plus.pm
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/lib/Parrot/Test/Hq9plus.pm  Sat Mar 29 04:16:42 2008
@@ -0,0 +1,95 @@
+# $Id$
+
+# Copyright (C) 2005-2008, The Perl Foundation.
+
+package Parrot::Test::Hq9plus;
+
+use strict;
+use warnings;
+
+use Data::Dumper;
+use File::Basename;
+
+use Parrot::Test;
+
+=head1 NAME
+
+Parrot::Test::Hq9plus - Testing routines specific to 'HQ9plus'.
+
+=head1 DESCRIPTION
+
+Call hq9plus.pbc
+
+=cut
+
+# Generate output_is(), output_isnt() and output_like() in current package.
+Parrot::Test::generate_languages_functions();
+
+=head1 METHODS
+
+=head2 new
+
+=cut
+sub new {
+    return bless {};
+}
+
+sub get_out_fn {
+    my $self = shift;
+    my ( $count, $options ) = @_;
+
+    return Parrot::Test::per_test( '.out', $count );
+}
+
+sub get_test_prog {
+    my $self = shift;
+    my ( $count, $options ) = @_;
+
+    my $lang_fn = Parrot::Test::per_test( '.HQ9plus', $count );
+    ( undef, undef, my $current_dir ) = File::Spec->splitpath( Cwd::getcwd() );
+    if ( $current_dir eq 'languages' ) {
+        $lang_fn = File::Spec->catdir( '..', $lang_fn );
+    }
+
+#43266: [TODO] Make the Parrot::Test::<lang> Perl5 modules less redundant
+#
+    my $test_prog_args = $ENV{TEST_PROG_ARGS} || q{};
+
+    return
+        join( ' ',
+              "../../$self->{parrot}",
+              'hq9plus.pbc',
+              $test_prog_args,
+              $lang_fn );
+}
+
+sub get_cd {
+    my $self = shift;
+    my ( $options ) = @_;
+
+    return "$self->{relpath}/languages/hq9plus";
+}
+
+sub get_lang_fn {
+    my $self = shift;
+    my ( $count, $options ) = @_;
+
+    return Parrot::Test::per_test( '.HQ9plus', $count );
+}
+
+# never skip
+sub skip_why {
+    my $self = shift;
+    my ($options) = @_;
+
+    return;
+}
+
+1;
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/languages/hq9plus/src/builtins/hello.pir
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/src/builtins/hello.pir      Sat Mar 29 04:16:42 2008
@@ -0,0 +1,25 @@
+# Copyright (C) 2006-2008, The Perl Foundation.
+# $Id$
+
+=head1
+
+hello.pir -- simple implementation of a hello function
+
+=cut
+
+.namespace
+
+.sub 'hello'
+
+    print "Hello, world!\n"
+
+    .return ( )
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

Added: trunk/languages/hq9plus/src/builtins/nintynine_bottles_of_beer.pir
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/src/builtins/nintynine_bottles_of_beer.pir  Sat Mar 
29 04:16:42 2008
@@ -0,0 +1,72 @@
+# Copyright (C) 2008, The Perl Foundation.
+# $Id$
+
+=head1
+
+nintynine_bottles_of_beer.pir -- simple implementation of a 
nintynine_bottles_of_beer function
+
+=cut
+
+.namespace
+
+.sub 'nintynine_bottles_of_beer'
+
+    set I1, 99 # bottles of beer
+    set I2, 1  # single bottle
+
+    set S1, " of beer on the wall,\n"
+    set S2, " of beer,\n"
+    set S3, "Take one down, pass it around,\n"
+    set S4, " of beer on the wall.\n\n"
+
+    set S5, " bottle"
+    set S6, " bottles"
+
+    set S7, "No more bottles of beer on the wall.\n\n"
+
+    set S8, "*Buuurrp*\n"
+
+    branch N_BOTTLES # start drinking
+
+    N_BOTTLES:
+            print I1
+            print S6
+            print S1
+            print I1
+            print S6
+            print S2
+            print S3
+            dec I1
+            eq I1, I2, BOTTLE_OF # Aww, we're getting low
+            print I1
+            print S6
+            print S4
+            ne I1, I2, N_BOTTLES # keep on drinking
+
+    BOTTLE_OF:
+            print I1
+            print S5
+            print S4
+            branch ONE_BOTTLE # 'bout time for a liver transplant
+
+    ONE_BOTTLE: # it's been fun
+            print I1
+            print S5
+            print S1
+            print I1
+            print S5
+            print S2
+            print S3
+            print S7
+            print S8
+
+    .return ( )
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

Added: trunk/languages/hq9plus/src/builtins/plus.pir
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/src/builtins/plus.pir       Sat Mar 29 04:16:42 2008
@@ -0,0 +1,28 @@
+# Copyright (C) 2006-2008, The Perl Foundation.
+# $Id$
+
+=head1
+
+plus.pir -- simple implementation of a plus function
+
+=cut
+
+.namespace
+
+.sub 'plus' :outer(main)
+
+    .local pmc accumulator
+    accumulator = find_lex "$accumulator"
+
+    inc accumulator
+
+    .return( )
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

Added: trunk/languages/hq9plus/src/builtins/quine.pir
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/src/builtins/quine.pir      Sat Mar 29 04:16:42 2008
@@ -0,0 +1,28 @@
+# Copyright (C) 2006-2008, The Perl Foundation.
+# $Id$
+
+=head1
+
+quine.pir -- simple implementation of a quine function
+
+=cut
+
+.namespace
+
+.sub 'quine'  :outer(main)
+
+    .local pmc code_string
+    code_string = find_lex "$code_string"
+
+    print code_string
+
+    .return ( )
+.end
+
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

Added: trunk/languages/hq9plus/src/parser/actions.pm
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/src/parser/actions.pm       Sat Mar 29 04:16:42 2008
@@ -0,0 +1,39 @@
+# $Id$
+# Copyright (C) 2008, The Perl Foundation.
+
+=begin comments
+
+HQ9plus::Grammar::Actions - ast transformations for HQ9plus
+
+This file contains the methods that are used by the parse grammar
+to build the PAST representation of an HQ9plus 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 HQ9plus::Grammar::Actions;
+
+method TOP($/) {
+    my $past := PAST::Block.new( :blocktype('declaration'), :node( $/ ) );
+    for $<statement> {
+        $past.push( $( $_ ) );
+    }
+    make $past;
+}
+
+method statement($/,$key) {
+    my $past := PAST::Op.new( :name($key), :pasttype('call'), :node( $/ ) );
+    make $past;
+}
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
+

Added: trunk/languages/hq9plus/src/parser/grammar.pg
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/src/parser/grammar.pg       Sat Mar 29 04:16:42 2008
@@ -0,0 +1,39 @@
+# $Id$
+# Copyright (C) 2008, The Perl Foundation.
+
+=begin overview
+
+This is the grammar for HQ9plus written as a sequence of Perl 6 rules.
+
+=end overview
+
+grammar HQ9plus::Grammar is PCT::Grammar;
+
+rule TOP {
+    <statement>*
+    [ $ || <panic: Syntax error> ]
+    {*}
+}
+
+rule statement {
+    | <hello>                      {*}   #= hello
+    | <quine>                      {*}   #= quine
+    | <nintynine_bottles_of_beer>  {*}   #= nintynine_bottles_of_beer
+    | <plus>                       {*}   #= plus
+}
+
+rule hello {
+      'H' {*}
+}
+
+rule quine {
+      'Q' {*}
+}
+
+rule nintynine_bottles_of_beer {
+      '9' {*}
+}
+
+rule plus {
+      '+' {*}
+}

Copied: trunk/languages/hq9plus/t/basic.t (from r26569, 
/trunk/languages/HQ9plus/t/basic.t)
==============================================================================
--- /trunk/languages/HQ9plus/t/basic.t  (original)
+++ trunk/languages/hq9plus/t/basic.t   Sat Mar 29 04:16:42 2008
@@ -1,23 +1,23 @@
 #! perl
 
-# Copyright (C) 2006-2007, The Perl Foundation.
+# Copyright (C) 2006-2008, The Perl Foundation.
 # $Id$
 
 =head1 NAME
 
-HQ9plus/t/basic.t - tests for HQ9plus
+hq9plus/t/basic.t - tests for HQ9plus
 
 =head1 DESCRIPTION
 
-Very basic checks, but all tests of HQ9plus are necessarily basic
+Very basic checks, but all tests of HQ9plus are necessarily basic.
 
 =cut
 
 use strict;
 use warnings;
-use lib qw( lib ../lib ../../lib HQ9plus/lib );
+use lib qw( lib ../lib ../../lib hq9plus/lib );
 
-use Parrot::Test tests => 6;
+use Parrot::Test tests => 13;
 
 my $song_text = <<'END_SONG';
 99 bottles of beer on the wall,
@@ -521,22 +521,43 @@
 my $hello = "Hello, world!\n";
 
 my $code = 'H';
-language_output_is( 'HQ9plus', $code, $hello, "code: $code" );
+language_output_is( 'hq9plus', $code, $hello, "code: $code" );
+
+$code = 'H H';
+language_output_is( 'hq9plus', $code, $hello x 2, "code: $code" );
+
+$code = 'HHH';
+language_output_is( 'hq9plus', $code, $hello x length($code), "code: $code", 
todo => 'ws handling' );
 
 $code = 'Q';
-language_output_is( 'HQ9plus', $code, $code, "code: $code" );
+language_output_is( 'hq9plus', $code, $code, "code: $code" );
+
+$code = 'Q Q';
+language_output_is( 'hq9plus', $code, $code x 2, "code: $code" );
+
+$code = 'QQQ';
+language_output_is( 'hq9plus', $code, $code x length($code), "code: $code", 
todo => 'ws handling' );
 
 $code = '9';
-language_output_is( 'HQ9plus', $code, $song_text, "code: $code" );
+language_output_is( 'hq9plus', $code, $song_text, "code: $code" );
+
+$code = '9 9';
+language_output_is( 'hq9plus', $code, $song_text x 2, "code: $code" );
+
+$code = '999';
+language_output_is( 'hq9plus', $code, $song_text x length($code), "code: 
$code", todo => 'ws handling' );
 
 $code = '+';
-language_output_is( 'HQ9plus', $code, '', "code: $code" );
+language_output_is( 'hq9plus', $code, '', "code: $code" );
 
-$code = 'HQ9+';
-language_output_is( 'HQ9plus', $code, $hello . $code . $song_text, "code: 
$code" );
+$code = '+ +';
+language_output_is( 'hq9plus', $code, '' x 2, "code: $code" );
 
-$code = 'QQQQ';
-language_output_is( 'HQ9plus', $code, $code x length($code), "code: $code" );
+$code = '+++++++++++++++++++';
+language_output_is( 'hq9plus', $code, '', "code: $code", todo => 'ws handling' 
);
+
+$code = 'HQ9+';
+language_output_is( 'hq9plus', $code, $hello . $code . $song_text, "code: 
$code", todo => 'ws handling' );
 
 # Local Variables:
 #   mode: cperl

Added: trunk/languages/hq9plus/t/harness
==============================================================================
--- (empty file)
+++ trunk/languages/hq9plus/t/harness   Sat Mar 29 04:16:42 2008
@@ -0,0 +1,8 @@
+#! perl
+
+# $Id$
+
+use FindBin;
+use lib qw( . lib ../lib ../../lib );
+use Parrot::Test::Harness language => 'hq9plus';
+

Modified: trunk/languages/perl6/src/classes/IO.pir
==============================================================================
--- trunk/languages/perl6/src/classes/IO.pir    (original)
+++ trunk/languages/perl6/src/classes/IO.pir    Sat Mar 29 04:16:42 2008
@@ -1,4 +1,4 @@
-## $Id: $
+## $Id$
 
 =head1 TITLE
 

Modified: trunk/languages/t/harness
==============================================================================
--- trunk/languages/t/harness   (original)
+++ trunk/languages/t/harness   Sat Mar 29 04:16:42 2008
@@ -92,7 +92,7 @@
               cola
               dotnet
               eclectus
-              HQ9plus
+              hq9plus
               jako
               lazy-k lisp lua
               m4

Reply via email to