Mike,

Here is another function to add to axiom.py:

----
    def compile(self,code, filename="temp.spad", verbose=False):
        """
        Compiles a library module written in spad

        EXAMPLES:
            sage: axiom.compile('''
            )abbrev package FOO foo
            Foo():with
                bar: Integer->Integer
              == add
                bar(x) == x+1
            ''')
            sage: axiom.bar(1)
            2
        """
        fh=open(filename,"w")
        fh.write(code)
        fh.close()
        s = self.eval(")compile "+filename)
        if verbose:
            print s
        else: # cleanup some of the mess
            cleanup = re.compile(r'^\)compile [^\n]*\n|'
                     r'(?:^\s*Compiling[^\n]*\n|'
                     r'\n\s*;;[^\n]*\n|'
                     r'\n\s*---[^\n]*\n|'
                     r'\n\s*compiling into[^\n]*\n|'
                     r'\n\s*\n)|'
                     r'\n\s*Time:[^\n]*\n|'
                     r'\n\(time[^\n]*\n',
                     re.DOTALL+re.MULTILINE)
            s=cleanup.sub(r'\n',s)
            s=cleanup.sub(r'\n',s)
            print cleanup.sub(r'\n',s)
----

This provides preliminary support for compiling new Axiom library code
written in the Spad language.

Regards,
Bill Page.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to