Author: bernhard
Date: Wed Oct 26 14:03:54 2005
New Revision: 9581

Modified:
   trunk/languages/LANGUAGES.STATUS
   trunk/languages/ook/Changes
   trunk/languages/ook/ook.pasm
Log:
Make Ook fit for Parrot 0.3.0


Modified: trunk/languages/LANGUAGES.STATUS
==============================================================================
--- trunk/languages/LANGUAGES.STATUS    (original)
+++ trunk/languages/LANGUAGES.STATUS    Wed Oct 26 14:03:54 2005
@@ -120,7 +120,7 @@ A: Jerome Quelin
 D: Functioning compiler targeting pasm.
 S: Samples working, README explain how to build/use.
 M: Yes
-V: 0.0.11
+V: 0.3.0
 
 N: OpenComal
 D: Compiler emiting parrot being added to interpreter

Modified: trunk/languages/ook/Changes
==============================================================================
--- trunk/languages/ook/Changes (original)
+++ trunk/languages/ook/Changes Wed Oct 26 14:03:54 2005
@@ -2,6 +2,9 @@
 
 Revision history for a Ook! compiler written in Parrot and targeting Parrot.
 
+0.2.1 Mi Okt 26 22:59:41 CEST 2005
+        - Make it work on Parrot 0.3.0
+
 0.2.0 Tue Apr  5 20:35:49 CEST 2005
         - fixed register usage to leave bottom half of register (0->15)
           for parrot internal use.

Modified: trunk/languages/ook/ook.pasm
==============================================================================
--- trunk/languages/ook/ook.pasm        (original)
+++ trunk/languages/ook/ook.pasm        Wed Oct 26 14:03:54 2005
@@ -1,15 +1,22 @@
 # $Id$
 
+=head1 NAME
+
+ook.pasm - An implementation of ook in PASM
+
+=cut
+
 # First, read the file.
+        get_params "(0)", P5
         set S20, P5[1]      # Name of the Ook source.
-       open P20, S20, "<"  # P20 = file descriptor
-       set S21, ""         # S21 = accumulator
+        open P20, S20, "<"  # P20 = file descriptor
+        set S21, ""         # S21 = accumulator
 READ:
-       read S22, P20, 256
-       length I20, S22
-       le I20, 0, EOF
-       concat S21, S22
-       branch READ
+        read S22, P20, 256
+        length I20, S22
+        le I20, 0, EOF
+        concat S21, S22
+        branch READ
 EOF:
         close P20
 
@@ -102,12 +109,15 @@ LOOP_LINEFEED:
         # Fallthru.
 LOOP_END:
         le I21, I20, LOOP
-        concat S24, "\tend\n"
-        #print S24
-        #end
-        compreg P22, "PASM"
-       compile P0, P22, S24
-       invokecc
+        concat S24, "\tset_returns \"()\"\n"
+        concat S24, "\treturncc\n"
+
+# Execute the generated code in S24
+        compreg P1, "PASM"
+        set_args "(0)", S24
+        get_results "(0)", P0
+        invokecc P1
+        invokecc P0
         end
 
 # Given the content of P21, create a label of integers concateneted in S26.
@@ -125,5 +135,3 @@ LABEL_LOOP:
 LABEL_END:
         lt I26, I25, LABEL_LOOP
         ret
-
-

Reply via email to