Re: recent changes

2007-02-08 Thread Audrey Tang

在 Feb 9, 2007 5:17 AM 時,Larry Wall 寫到:

Questions and feedback welcome, but please don't follow up to this
message--start a new thread for a new topic.  Bear in mind that
this is completely untested code, still fairly buggy and incomplete.
Not even pugs can parse it (yet).


Note: After some typo fixes and minor workarounds, Pugs now parses it  
just fine -- the task now is how to run it, and run it _fast_, before  
we make it part of sanity. :-)


Cheers,
Audrey

[svn:perl6-synopsis] r13579 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 18:27:11 2007
New Revision: 13579

Modified:
   doc/trunk/design/syn/S02.pod

Log:
typo from all_beryb++ :)


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 18:27:11 2007
@@ -2613,7 +2613,7 @@
 @result = @x.grep:{...};
 
 However, this I is strictly a syntactic transformation,
-so a list computed any other way will not triger the rewrite:
+so a list computed any other way will not trigger the rewrite:
 
 @result = (@x = each(@y)) ~~ {...}; # not a comprehension
 


[svn:perl6-synopsis] r13578 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 18:18:06 2007
New Revision: 13578

Modified:
   doc/trunk/design/syn/S02.pod

Log:
typo from dataweaver++


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 18:18:06 2007
@@ -2612,7 +2612,7 @@
 
 @result = @x.grep:{...};
 
-However, this I is strictly a syntactic transformation,
+However, this I is strictly a syntactic transformation,
 so a list computed any other way will not triger the rewrite:
 
 @result = (@x = each(@y)) ~~ {...}; # not a comprehension


Re: Negative array subscripts

2007-02-08 Thread Blair Sutton

Rafael Garcia-Suarez wrote:

Smylers wrote in perl.perl6.language :
  

Hmmm, a pragma's a bit heavyweight for this; how about being able to set
this with a special global variable -- that sure sounds handy ...



Actually, in perl 5, $[ *is* a pragma... :)

  
A feature I have never felt the need to use but useful in any case. I 
suspect there is a way in Perl 6 to specify Parrot grammar directives 
that could adjust this behaviour? Maybe even allow you to use named 
numbers as well as digits, i.e. @a[zero], @b[twelve]... :)


Re: recent changes

2007-02-08 Thread Larry Wall
I should also point out that I'm excruciatingly grateful for all the
prior art in the various Perl 6 parsers that various random geniuses
have been working on.  In particular:

pmichaud++
fglock++
putter++
audreyt++

Their parsers actually work, unlike mine.  :)

Larry


recent changes

2007-02-08 Thread Larry Wall
If you folks are wondering what's driving the flurry of recent synopsis
changes, it's the Perl 6 grammar written in Perl 6 that I've been working
on for the last week, and thinking about for the last month.  If you
want to peek at the current snapshot, it's at:

http://svn.pugscode.org/pugs/src/perl6/Perl-6.0.0-STD.pm

Questions and feedback welcome, but please don't follow up to this
message--start a new thread for a new topic.  Bear in mind that
this is completely untested code, still fairly buggy and incomplete.
Not even pugs can parse it (yet).  Nevertheless, I think it will help
ground some of the discussion here to have a real grammar to look at,
written in something close to our favorite language.  :)

If you use vim, the perl6.vim in pugs/util directory will do a semi-decent
job of hilighting.  Feel free to patch perl6.vim where it doesn't.

If you want to work on some part of the grammar, that's fine, but
either update frequently with svn or let me know which parts I should
leave alone while you work on them.

Larry


[svn:perl6-synopsis] r13577 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 13:52:24 2007
New Revision: 13577

Modified:
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S05.pod
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S12.pod

Log:
Unified proto processing to implicitly allow redeclarations within scope.
This works on most declarators, including regex, token, rule, and variables.
Multiple my declarations warn about redeclaration as suggested by lukastic++.
This may be suppressed with a "proto" declaration of the variable.
The "multi" keyword is now optional in the scope of a proto.
The "unique" keyword now "undoes" an outer "proto".


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podThu Feb  8 13:52:24 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 29 Jan 2007
+  Last Modified: 8 Feb 2007
   Number: 4
-  Version: 50
+  Version: 51
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -75,6 +75,15 @@
 my $x;
 my $x;
 
+By default the second declaration will get a compiler warning.
+You may suppress this by modifying the first declaration
+with C:
+
+my proto $x;
+...
+while my $x = @x.shift {...}  # no warning
+while my $x = @x.shift {...}  # no warning
+
 If you've referred to C<$x> prior to the first declaration, and the compiler
 tentatively bound it to C<$OUTER::x>, then it's an error to declare it, and
 the compiler is required to complain at that point.  If such use can't

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podThu Feb  8 13:52:24 2007
@@ -14,9 +14,9 @@
Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
Larry Wall <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 5 Feb 2007
+   Last Modified: 8 Feb 2007
Number: 5
-   Version: 50
+   Version: 51
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I rather than "regular
@@ -670,17 +670,19 @@
 
 =item *
 
-Alternatively, if you predeclare a category, you can write multiple
-rules for the same category, differentiated only by the symbol they
+Alternatively, if you predeclare a proto regex, you can write multiple
+regexes for the same category, differentiated only by the symbol they
 match:
 
-category sigil;
-token sigil { :<$> }
-token sigil { :<@> }
-token sigil { :<@@> }
-token sigil { :<%> }
-token sigil { :<&> }
-token sigil { :<::> }
+proto token sigil;
+multi token sigil { :<$> }
+multi token sigil { :<@> }
+multi token sigil { :<@@> }
+multi token sigil { :<%> }
+multi token sigil { :<&> }
+multi token sigil { :<::> }
+
+(The C is optional and generally omitted with a grammar.)
 
 This can be viewed as a form of multiple dispatch, except that it's
 based on longest-token matching rather than signature matching.  The
@@ -688,6 +690,11 @@
 rules to the same category in a derived grammar.  All of them will
 be matched in parallel when you try to match C<< // >>.
 
+If there are formal parameters on multi regex methods, matching
+still proceeds via longest-token rules first.  If that results in a
+tie, a normal multiple dispatch is made using the arguments to the
+remaining variants, assuming they can be differentiated by type.
+
 =item *
 
 An interpolated hash matches the longest possible token.  The match

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podThu Feb  8 13:52:24 2007
@@ -58,7 +58,11 @@
 
 B (keyword: C) specify the commonalities (such
 as parameter names, fixity, and associativity) shared by all multis
-of that name in the scope of the C declaration.
+of that name in the scope of the C declaration.  A C
+also forces all routines of the same short name within the scope to
+be considered C whether they are explicitly declared so or not.
+(This is particularly useful when adding to rule sets or when attempting
+to compose conflicting methods from roles.)
 
 A modifier keyword may occur before the routine keyword in a named routine:
 

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podThu Feb  8 13:52:24 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 3 Feb 2007
+  Last Modified: 8 Feb 2007
   Number: 12
-  Version: 38
+  Version: 39
 
 =head1 Overview
 
@@ -729,7 +729,

Re: Negative array subscripts

2007-02-08 Thread Blair Sutton

Rafael Garcia-Suarez wrote:

Smylers wrote in perl.perl6.language :
  

Hmmm, a pragma's a bit heavyweight for this; how about being able to set
this with a special global variable -- that sure sounds handy ...



Actually, in perl 5, $[ *is* a pragma... :)

  

A feature I have never felt the need to use but useful in any case. I
suspect there is a way in Perl 6 to specify Parrot grammar directives
that could adjust this behaviour? Maybe even allow you to use named
numbers as well as digits, i.e. @a[zero], @b[twelve]... :)



[svn:perl6-synopsis] r13576 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 13:08:10 2007
New Revision: 13576

Modified:
   doc/trunk/design/syn/S02.pod

Log:
typo, plus forgot to bump version


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 13:08:10 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 7 Feb 2007
+  Last Modified: 8 Feb 2007
   Number: 2
-  Version: 84
+  Version: 85
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1929,7 +1929,7 @@
 tr///   Q :trans ///
 
 Adverbs such as C<:regex> change the language to be parsed by switching
-to a different parser.  This can completely change the interpreation
+to a different parser.  This can completely change the interpretation
 of any subsequent adverbs as well as the quoted material itself.
 
 q:s//   Q :q :scalar //


[svn:perl6-synopsis] r13575 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 13:04:46 2007
New Revision: 13575

Modified:
   doc/trunk/design/syn/S02.pod

Log:
Added mother-of-all-quoting-forms Q// for compositional sanity.
qn// is now gone, since Q// does that without having to "undo" a q//.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 13:04:46 2007
@@ -1917,6 +1917,26 @@
 
 =item *
 
+In addition to C and C, there is now the base form C which does
+I interpolation unless explicitly modified to do so.  So C is really
+short for C and C is short for C.  In fact, all quote-like
+forms derive from C with adverbs:
+
+q// Q :q //
+qq//Q :qq //
+rx//Q :regex //
+s///Q :subst ///
+tr///   Q :trans ///
+
+Adverbs such as C<:regex> change the language to be parsed by switching
+to a different parser.  This can completely change the interpreation
+of any subsequent adverbs as well as the quoted material itself.
+
+q:s//   Q :q :scalar //
+rx:s//  Q :regex :sigspace //
+
+=item *
+
 Generalized quotes may now take adverbs:
 
 Short   LongMeaning
@@ -1924,8 +1944,6 @@
 :x  :exec   Execute as command and return results
 :w  :words  Split result on words (no quote protection)
 :ww :quotewords Split result on words (with quote protection)
-:t  :to Interpret result as heredoc terminator
-:n  :none   No escapes at all (unless otherwise adverbed)
 :q  :single Interpolate \\, \q and \' (or whatever)
 :qq :double Interpolate with :s, :a, :h, :f, :c, :b
 :s  :scalar Interpolate $ vars
@@ -1934,6 +1952,10 @@
 :f  :function   Interpolate & calls
 :c  :closureInterpolate {...} expressions
 :b  :backslash  Interpolate \n, \t, etc. (implies :q at least)
+:to Parse result as heredoc terminator
+:regex  Parse as regex
+:subst  Parse as substitution
+:trans  Parse as transliteration
 :code   Quasiquoting
 
 Ordinarily the colon is required on adverbs, but the C declarator
@@ -1941,11 +1963,11 @@
 without an intervening colon:
 
 quote qw;   # declare a P5-esque qw// meaning q:w
-quote qn;   # completely raw quote qn//
-quote qnc;  # q:n:c//, interpolate only closures
+quote Qc;   # Q:c//, interpolate only closures
 
-Actually, the first two are already assumed, because you get all of the
-forms that use as single character predeclared for free.
+Actually, those two are already assumed, because you get all of the
+forms that use a single character modifier predeclared for free.  (Note
+this means that C doesn't intepolate.)
 
 If you want to abbreviate further, you may also give an explicit
 definition as either a string or quasiquote:
@@ -1957,28 +1979,28 @@
 In particular, all these forms disable the lookahead for an adverbial argument,
 as if there were a space after the keyword.  So although
 
-q:n($foo)
+q:s($foo)
 
-will misinterpret C<$foo> as the C<:n> argument,
+will misinterpret C<$foo> as the C<:s> argument,
 
-qn(stuff)
+qs(stuff)
 
-has the advantage of misinterpreting it as the argument to the C
+has the advantage of misinterpreting it as the argument to the C
 function instead.  C<:)>
 
 But parens are special that way.  (Even C is assumed to be a
 function call rather than a quote.)  Other bracketing characters are
 special only if they can be mistaken for adverbial arguments, so
 
-qn[stuff]
+qs[stuff]
 
 is fine, and means
 
-q:n /stuff/
+q:s /stuff/
 
 while
 
-q:n[stuff]
+q:s[stuff]
 
 also happens to work because quote adverbs only allow the paren form of
 bracketed adverbs.
@@ -1987,16 +2009,16 @@
 adverbs and operators as standard macros.  The main difference is that,
 unlike
 
-quote qn = 'q:n';
+quote qs = 'q:s';
 
 declaring something like
 
-macro qn { 'q:n' }
+macro qs { 'q:s' }
 
 does I disable the subsequent search for a parenthesized argument
 to C<:n>.  To get the equivalent, you need to add a space:
 
-macro qn { 'q:n ' }
+macro qs { 'q:s ' }
 
 All the uppercase adverbs are reserved for user-defined quotes.
 All Unicode delimiters above Latin-1 are reserved for user-defined quotes.


[PATCH] languages/PIR fix string encoding, hex and binary numbers

2007-02-08 Thread Klaas-Jan Stol

hi

attached a patch for languages/PIR fixing:

* added optional "utf8:" encoding specifier (according to 
docs/imcc/syntax.pod)

* fixed support for binary and hex. numbers
* added test for these changes.

regards,
klaas-jan
Index: languages/PIR/lib/pir.pg
===
--- languages/PIR/lib/pir.pg	(revision 16923)
+++ languages/PIR/lib/pir.pg	(working copy)
@@ -703,19 +703,17 @@
 #
 
 token int_constant {
-[-]? \d+
-  | 
+
   | 
+  | [-]? \d+
 }
 
-# FIXTHIS
-regex hex_constant {
-  \d+
+token hex_constant {
+  0x\d+
 }
 
-# FIXTHIS
-regex binary_constant {
-  \d+
+token binary_constant {
+  0b\d+
 }
 
 token float_constant {
@@ -724,10 +722,13 @@
 
 
 rule string_constant {
-  ? 
+	[ ?  ]?
   [  |  ]
 }
 
+rule encoding_specifier {
+	<'utf8:'>
+}
 
 rule charset_specifier {
   [ <'ascii:'> | <'binary:'> | <'unicode:'> | <'iso-8859-1:'> ]  
Index: languages/PIR/t/assign.t
===
--- languages/PIR/t/assign.t	(revision 16923)
+++ languages/PIR/t/assign.t	(working copy)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use lib qw(t . lib ../lib ../../lib ../../../lib);
-use Parrot::Test tests => 6;
+use Parrot::Test tests => 7;
 use Test::More;
 
 language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'simple assignments' );
@@ -18,6 +18,16 @@
 Parse successful!
 OUT
 
+language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'int/hex/bin' );
+.sub main			
+	a = 10
+	b = 0b10
+	c = 0x10	
+.end
+CODE
+"parse" => PMC 'PIRGrammar' { ... }
+Parse successful!
+OUT
 
 language_output_is( 'PIR_PGE', <<'CODE', <<'OUT', 'get keyed assignments' );
 .sub main			
@@ -93,6 +103,7 @@
 	s = binary:"Hello WOrld"
 	s = unicode:"Hello world"
 	s = iso-8859-1:"Hello world"		 
+	s = utf8:unicode:"Hello World"
 .end
 CODE
 "parse" => PMC 'PIRGrammar' { ... }


[svn:perl6-synopsis] r13574 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 09:43:50 2007
New Revision: 13574

Modified:
   doc/trunk/design/syn/S03.pod

Log:
Unconjectured the directed hyper semantics on trees per feedback from
GPU-programming lambdafolk via audreyt++.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podThu Feb  8 09:43:50 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 5 Feb 2007
+  Last Modified: 8 Feb 2007
   Number: 3
-  Version: 99
+  Version: 100
 
 =head1 Overview
 
@@ -2682,9 +2682,8 @@
 is one of the ways that you can promise to the optimizer that your
 code is parallelizable.  (The tree visitation above is allowed to
 have side effects, but it is erroneous for the meaning of those side
-effects to depend on the order of visitation.  [Conjecture: we could
-allow dependencies that assume top-down visitation and only leaves
-sibling calls unordered.])
+effects to depend on the order of visitation in any way.  Hyper tree
+visitation is not required to follow DAG semantics, at least by default.)
 
 Even in the absence of hardware that can do parallel processing,
 hyperoperators may be faster than the corresponding scalar operators


[PATCH] Updates and fixes for docs/imcc/syntax.pod

2007-02-08 Thread Klaas-Jan Stol

hi,

attached a patch for docs/imcc/syntax.pod

fixing:
* typo, changing eamples in examples
* added ", respectively" to description of binary/hex numbers
* added syntax description for slices:
 =  [  ]
where  is one of:
 .. 
.. 
 ..

Also, I added references to 2 files to the slicing part. Please note 
that there is not a clear description of what slicing should do. (or I 
overlooked).

My guess is that
   $P0 = $P1[ 1 .. 3 ]
should return an array with values from $P1[1], $P1[2] and $P[3].

Any confirmations or error marking would be appreciated.

regards,
klaas-jan

Index: docs/imcc/syntax.pod
===
--- docs/imcc/syntax.pod	(revision 16922)
+++ docs/imcc/syntax.pod	(working copy)
@@ -128,7 +128,7 @@
 
 =item encoding:charset:"string constant"
 
-Like above with an extra encoding attached to the string. For eample:
+Like above with an extra encoding attached to the string. For example:
 
   set S0, utf8:unicode:"«"
 
@@ -137,7 +137,7 @@
 
 =item numeric constants
 
-B<0x> and B<0b> denote hex and binary constants.
+B<0x> and B<0b> denote hex and binary constants respectively.
 
 =back
 
@@ -435,6 +435,26 @@
 This generates either a keyed B operation or B for string arguments and an integer key.
 
+=item  =  [  ]
+
+where C is:
+
+  .. 
+
+returns a slice defined starting at C and ending at C.
+
+ .. 
+
+returns a slice starting at the first element, and ending at C.
+
+  ..
+
+returns a slice starting at C to the end of the array.
+
+see src/pmc/slice.pmc
+and t/pmc/slice.t.
+
+
 =item  [  ] = 
 
 A keyed B operation or the assign B op with a length of


[PATCH] Update ASTGrammar for lang/PIR

2007-02-08 Thread Klaas-Jan Stol

hi,

attached an update for ASTGrammar.tg for languages/PIR

In order to print the past tree to screen, set 'target' to 'past' in 
pirc.pir. Currently, it is set to 'parse' in order to pass the tests.


regards,
klaas-jan
Index: languages/PIR/lib/ASTGrammar.tg
===
--- languages/PIR/lib/ASTGrammar.tg	(revision 16922)
+++ languages/PIR/lib/ASTGrammar.tg	(working copy)
@@ -1,506 +1,330 @@
 
 grammar ASTGrammar is TGE::Grammar;
 
-transform past (ROOT) :language('PIR') {
-# Ask the child node for its result
-.local pmc child
-.local pmc result
-
-
-result = new 'PAST::Block'
-result.'init'('node'=>node, 'name'=>'anon')
 
-
-#.return(result)
-
-$I0 = defined node["program"]
-unless $I0 goto err_no_tree
-$P0 = node["program"]
-print "\nSuccess!\n"
-#printerr "SOURCE:\n"
-#$S0 = node["source"]
-#printerr $S0
-#printerr "\n\n"
-child = tree.get('past', $P0, 'PIRGrammar::program')
-		print "Back from tree\n\n"
-result.'push'(child)
-.return (result)
-
-  err_no_tree:
-print "The top-level node doesn't contain a 'program' match.\n"
-end
+# past (ROOT)
+#
+# Transform the 'program' rule into a PAST::Block.
+#
+transform past (ROOT) :language('PIR') { 
+.local pmc past
+		past = new 'PAST::Block'
+		past.'init'('node'=>node, 'name'=>'anon')
+
+.local pmc childnode, childpast
+childnode = node['program']
+childpast = tree.'get'('past', childnode, 'PIRGrammar::program')
+		past.'push'(childpast)
+.return (past)  
 }
 
-
+# past (PIRGrammar::program)
+#
+# Store each of the compilation units into a PAST::Stmts node.
+#
 transform past (PIRGrammar::program) :language('PIR') {
-.local pmc result
-result = new 'PAST::Stmts'
-result.'init'('node'=>node)
+.local pmc past
+past = new 'PAST::Stmts'
+past.'init'('node'=>node)
 
-$S0 = node["source"]
-printerr "SOURCE:\n"
-printerr $S0
-printerr "\n\n"
-
-# Ask the child node for its result
-.local pmc child
-$I0 = defined node["compilation_unit"]
-unless $I0 goto err_no_tree
-$P0 = node["compilation_unit"]
-print $P0		
 .local pmc iter
-iter = new Iterator, $P0# setup iterator for node
-iter = 0
-
-  iter_loop:  	
-unless iter, iter_end # while (entries) ...
-  shift $P2, iter  
-  $P3 = tree.get('past', $P2, 'PIRGrammar::compilation_unit')
-  result.'push'($P3)
-  goto iter_loop
+$P0 = node['compilation_unit']
+if null $P0 goto iter_end
+iter = new .Iterator, $P0
+  iter_loop:
+unless iter goto iter_end
+.local pmc cnode, cpast
+cnode = shift iter
+cpast = tree.'get'('past', cnode, 'PIRGrammar::compilation_unit')
+past.'push'(cpast)
+goto iter_loop
   iter_end:
-	
-.return (result)
-  err_no_tree:
-print "The 'program' node doesn't contain a 'compilation_unit' match.\n"
-.return (result)
+.return (past)
 }
 
+# past (PIRGrammar::compilation_unit)
+#
+# Call the appropiate transform rule depending on the type of compilation unit.
+#
 transform past (PIRGrammar::compilation_unit) :language('PIR') {
-.local pmc result
-result = new .ResizablePMCArray
+  global_def:
+$P0 = node['global_def']
+if null $P0 goto sub_def
+.return tree.'get'('past', $P0, 'PIRGrammar::global_def')
+  sub_def:
+$P0 = node['sub_def']
+if null $P0 goto const_def
+.return tree.'get'('past', $P0, 'PIRGrammar::sub_def')
+  const_def:
+$P0 = node['const_def']
+if null $P0 goto macro_def
+.return tree.'get'('past', $P0, 'PIRGrammar::const_def')
+  macro_def:
+$P0 = node['macro_def']
+if null $P0 goto pragma
+.return tree.'get'('past', $P0, 'PIRGrammar::macro_def')
+  pragma:
+  	$P0 = node['pragma']
+if null $P0 goto emit
+.return tree.'get'('past', $P0, 'PIRGrammar::pragma')
+  emit:  
+$P0 = node['emit']
+if null $P0 goto const_def
+.return tree.'get'('past', $P0, 'PIRGrammar::emit') 
+}
 
-.local pmc iter
-iter = new Iterator, node# setup iterator for node
-iter = 0
-  iter_loop:
-unless iter, iter_end # while (entries) ...
-  shift $S1, iter   # get the key of the iterator
-  $P2 = iter[$S1]
-  $S1 = concat 'PIRGrammar::', $S1
-  $P3 = tree.get('past', $P2, $S1)
-  if null $P3 goto iter_loop
-  push result, $P3
-  goto iter_loop
-  iter_end:
-$I0 = elements result
-if $I0 != 1 goto err_too_many
-$P4 = result[0]
-  
-.return ($P4)
-  err_too_many:
-print "A 'line' node can only have one child.\n"
-end
- 	.return(result)
+transform past (PIRGrammar::global_def) :language('PIR') {
+
 }
 
-transform past (PIRGrammar::class_def) :language('PIR') {
+# past (PIRGrammar::sub_def)
+#
+# Transform a sub_def into a PAST::Block node.
+#
+transfor

Re: Porting parrot on PDA

2007-02-08 Thread Hakim Cassimally

Sounds interesting.

I'm keen to port to maemo (Nokia N800) - I'm guessing this
will be easier as it's based on debian linux and uses
scratchbox for cross compilation, but I believe it doesn't
built out of the box.

I'd like to join the porting effort if there's enough crossover
to be able to help on this,

cheerio,
osfameron

(sorry to break replyTo headers, I'm just newly resubscribed
with this address)


message 36281
From: Aldo Calpini <[EMAIL PROTECTED]>
To: perl6-internals@perl.org
Date: Mon, 29 Jan 2007 18:36:08 +0100
Subject: Porting parrot on PDA
hello people!

I'm really interested in porting parrot to PDA (well, PocketPC at least).

some days ago I stumbled upon CeGCC (a cross compiler for PocketPC),
which is basically a windows port of gcc (both cygwin and mingw32
flavours) that produces ARM executable code.

I started playing with it, trying to use it to build parrot; with just a
few hours hacking, I managed to build a miniparrot.exe that actually
runs (sort of) on PocketPC.


I understand that what I've done is just a drop in the ocean, and that a
real porting would require tons and tons of work more, but at least this
first effort looks promising :-)

now I will try to report briefly what I've done so far. I obviously
started with "perl Configure.pl --ask", from a Cygwin bash shell.
mainly, I told Configure to use "arm-wince-pe-gcc" instead of just "gcc"
as the compiler, linker etc. and I disabled completely jit, threads and
all the frills.

of course, all the tests which relies on a test executable failed; they
did compile indeed, but the executable couldn't be run on the desktop
PC. that's the biggest problem, I suppose :-)

so, I had to manually adjust lots of #define in config.h, has_headers.h,
and later some minor fixes to feature.h, io.h and thread.h.

I had problems with compiling src/stm/backend.c, turned out that the
parameters to PARROT_ATOMIC_PTR_GET in atomic.h were reversed (this may
be a bug not related to building with cegcc, I don't know); and
ATOMIC_SET isn't defined, so I provided an optimistic (!):

#define ATOMIC_SET(a,b) (a).val = b;

I had to adjust also src/platform.c (the bits that come from
config/gen/platform/generic/exec.c) because cegcc doesn't provide fork,
execlp and waitpid. I used vfork, execvp and wait instead (I know, the
last one isn't equivalent at all -- a problem for later!).

at this point, miniparrot.exe was built. the process can't go much
further because, obviously, that miniparrot doesn't execute on the
desktop PC.

anyway, I tried copying the executable on the device, and it does run!
here's a transcript from my PocketConsole session:

\CF Card\dada> miniparrot -h
Couldn't create message pipe
\CF Card\dada>

something apparently didn't work with regard to thread handling. but it
shouldn't be that hard to fix.

the biggest problem, as mentioned, is that the build process needs
fundamentally to execute stuff (built for the device, that is). this
would require some serious hacking. IIRC, there are command line tools
to copy and even execute files directly on the device. this would make
possible to grab somehow the output and keep the build system happy.

I will try, if I can, to search for a viable solution in the next days.
if there's anybody else interested who wants to join the effort, let me
know :-)

cheers,
Aldo