Author: pmichaud
Date: Wed May 3 18:07:57 2006
New Revision: 12493
Modified:
trunk/languages/perl6/lib/builtins.pir
trunk/languages/perl6/lib/grammar_optok.pg
Log:
[perl6]:
* Fixed return values from say, print
* Restored infix ops: lt gt le ge eq ne * / % x +& +< +> ~ +| +^ ~| ~^
* Restored prefix ops: ?^ - +^ abs
Modified: trunk/languages/perl6/lib/builtins.pir
==============================================================================
--- trunk/languages/perl6/lib/builtins.pir (original)
+++ trunk/languages/perl6/lib/builtins.pir Wed May 3 18:07:57 2006
@@ -14,7 +14,7 @@
print $P0
goto iter_loop
iter_end:
- .return ()
+ .return (1)
.end
@@ -22,7 +22,7 @@
.param pmc list :slurpy
'print'(list :flat)
print "\n"
- .return ()
+ .return (1)
.end
@@ -38,6 +38,13 @@
.end
+.sub 'prefix:?^'
+ .param pmc a
+ $I0 = isfalse a
+ .return ($I0)
+.end
+
+
.sub 'infix:<'
.param pmc a
.param pmc b
@@ -92,6 +99,60 @@
.end
+.sub 'infix:lt'
+ .param pmc a
+ .param pmc b
+ $I0 = cmp_str a, b
+ $I0 = islt $I0, 0
+ .return ($I0)
+.end
+
+
+.sub 'infix:gt'
+ .param pmc a
+ .param pmc b
+ $I0 = cmp_str a, b
+ $I0 = isgt $I0, 0
+ .return ($I0)
+.end
+
+
+.sub 'infix:le'
+ .param pmc a
+ .param pmc b
+ $I0 = cmp_str a, b
+ $I0 = isle $I0, 0
+ .return ($I0)
+.end
+
+
+.sub 'infix:ge'
+ .param pmc a
+ .param pmc b
+ $I0 = cmp_str a, b
+ $I0 = isge $I0, 0
+ .return ($I0)
+.end
+
+
+.sub 'infix:eq'
+ .param pmc a
+ .param pmc b
+ $I0 = cmp_str a, b
+ $I0 = iseq $I0, 0
+ .return ($I0)
+.end
+
+
+.sub 'infix:ne'
+ .param pmc a
+ .param pmc b
+ $I0 = cmp_str a, b
+ $I0 = isne $I0, 0
+ .return ($I0)
+.end
+
+
.sub 'infix:**'
Modified: trunk/languages/perl6/lib/grammar_optok.pg
==============================================================================
--- trunk/languages/perl6/lib/grammar_optok.pg (original)
+++ trunk/languages/perl6/lib/grammar_optok.pg Wed May 3 18:07:57 2006
@@ -71,11 +71,10 @@
{ ... }
proto 'prefix:+' is equiv('prefix:!')
- is pir(" %t = %0 + 0")
{ ... }
proto 'prefix:-' is equiv('prefix:!')
- is pir(" %t = neg %0")
+ is post('neg')
{ ... }
proto 'prefix:~' is equiv('prefix:!')
@@ -92,7 +91,7 @@
proto 'prefix:~^' is equiv('prefix:!') { ... }
proto 'prefix:+^' is equiv('prefix:!')
- is pir(" %t = bnot %0")
+ is post('bnot')
{ ... }
proto 'prefix:?^' is equiv('prefix:!')
@@ -106,36 +105,32 @@
## multiplicative
proto 'infix:*' is precedence('17=')
is post('mul')
- is pir(" %t = %0 * %1")
{ ... }
proto 'infix:/' is equiv('infix:*')
is post('div')
- is pir(" %t = %0 / %1")
{ ... }
proto 'infix:%' is equiv('infix:*')
is post('mod')
- is pir(" %t = mod %0, %1")
{ ... }
proto 'infix:x' is equiv('infix:*')
is post('repeat')
- is pir(" %t = repeat %0, %1")
{ ... }
proto 'infix:xx' is equiv('infix:*') { ... }
proto 'infix:+&' is equiv('infix:*')
- is pir(" %r = band %0, %1")
+ is post('band')
{ ... }
proto 'infix:+<' is equiv('infix:*')
- is pir(" %r = shl %0, %1")
+ is post('shl')
{ ... }
proto 'infix:+>' is equiv('infix:*')
- is pir(" %r = shr %0, %1")
+ is post('shr')
{ ... }
proto 'infix:~&' is equiv('infix:*')
@@ -159,23 +154,22 @@
proto 'infix:~' is equiv('infix:+')
is post('concat')
- is pir(" %r = concat %0, %1")
{ ... }
proto 'infix:+|' is equiv('infix:+')
- is pir(" %r = %0 | %1")
+ is post('bor')
{ ... }
proto 'infix:+^' is equiv('infix:+')
- is pir(" %r = bxor %0, %1")
+ is post('bxor')
{ ... }
proto 'infix:~|' is equiv('infix:+')
- is pir(" %r = bors %0, %1")
+ is post('bors')
{ ... }
proto 'infix:~^' is equiv('infix:+')
- is pir(" %r = bxors %0, %1")
+ is post('bxors')
{ ... }
proto 'infix:?|' is equiv('infix:+')
@@ -208,7 +202,7 @@
proto 'prefix:abs' is equiv('rand')
is nullterm
- is pir(" %r = abs %0")
+ is post('abs')
{ ... }
proto 'prefix:-w' is equiv('prefix:rand') is nows { ... }