[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AOP/Fast matrices/Type hinting



Here are the links to the AOP research that describes the `loop
collapsing':

http://www.stanford.edu/~amitp/Java/amgoyal/aop.html
http://www.parc.xerox.com/csl/groups/sda/publications/papers/Kiczales-ECOOP97/for-web.pdf

There is a package called SERIES for Common Lisp that appears to do
the same sort of thing:

http://series.sourceforge.net/

All of the above is Lisp so should be eminently stealable and
hackable. It is possible that doing this kind of smart programming
would get back the losses from a rather simple minded
compiler. Anything that is better than Matlab will get my attention!

-------

Type hinting:

The way Gambit does type hinting (which I think is the same as Common
Lisp) is with the declare special form.

http://www.iro.umontreal.ca/~gambit/doc/gambit-c.html

"special form: declare declaration... 

This form introduces declarations to be used by the compiler(currently
the interpreter ignores the declarations). This form can only appear
where a define form is acceptable. Declarations are lexically scoped
in the same way as macros. The following declarations are accepted by
the compiler:

[snip]

(number-type primitive...) 
            Numeric arguments and result of the specified primitives
are known to be of the given type (all primitives if none
specified). number-type can be: `generic', `fixnum', or `flonum'."

-------

Re Paul's simple translation program:

Take a look at the pattern matching system in MzLib (match.ss). I find
it makes this sort of code a lot easier.

E.g.

(define (print-infix-call-arg arg)
  (if (list? arg)
      (print-call arg)
      (print arg)))

can be written as

(require-library "match.ss" "mzlib")

(define print-infix-call-arg
  (match-lambda
    [(arg . rest) (print-call arg)]
    [arg (print arg)]))

Note square brackets [] are equivalent to parentheses ()

DrScheme comes with a parser system called Zodiac, described best in
the DrScheme Extension Manual. I suspect its is over-kill if you only
want to compile a limited subset of Scheme to C (but maybe the
vocabularies will help?) 

cya,
Noel
-- 
Noel Welsh
http://www.dai.ed.ac.uk/~noelw/   noelw@dai.ed.ac.uk