Thursday, March 02, 2006

Lecture 3 (3/3/06) : Objects and OOP

Cover object oriented programming in Spiral. I will go over several examples of OOP in code generator implementation.

Spiral Material


Handout: oop.txt
Demo transcript: oop-demo.txt

Object Model

Spiral's object model is based on the following paper:

David Ungar and Randall BB. Smith
Self: The Power Of Simplicity
Proc. OOPSLA '87
[ps.gz] [Self website]

Interesting quote from above:
Elimination of meta­regress. No object in a class­based system can be self­ sufficient; another object (its class) is needed to express its structure and behavior. This leads to a conceptually infinite meta­regress: a point is an instance of class Point, which is an instance of metaclass Point, which is an instance of metameta­ class Point, ad infinitum. On the other hand, in prototype­based systems an object can include its own behavior; no other object is needed to breathe life into it. Proto­types eliminate meta­regress.

Case study

To better explain and motivate OOP style programming we will use Spiral's internal representation of generated code as a running example.

Micro-update

Today I was trying to finish recursive vector code, and of course lots of other things interfered. Several things happened today:
  • Fixed radix expansion of DftCt with left recursion in Maude, will produce a tail-recursive program, which can be converted into a loop. This has nice parallel with what FLAME is doing.
  • I talked to Franz and there are several issues with scalability of Spiral. We need to be able to compose several different codes: real, complex, FMA, fixed-point, vector, SMP, recursive and so forth.
Automatic iterative DFT construction is very nice, and easy to to in Maude. I will do this one day. Franz also showed me how to get a large sample of iterative variants automatically (Pease, Stockham, Korn-Lambiot, etc).

The scond main issue is scalability of Spiral. Here we came up with a list of TODOs:
  1. RulesFor(pattern, ...) (for example [TRC, [DFT, @]])
  2. Composable unparsers
    1. C99Unparser, TRC, TCR, TCC
    2. Composable CodeRuleTree, or at least one should resolve all conflicts within different modes
    3. This is complete when TCR(RDFT(..)) produces assymmetric code (real input, complex output)
  3. SPL/DP options record expansion. Franz also suggested the idea of "worksheet". Worksheet would keep options along with all intermediate results (ie. ruletree, formula, sigma-spl formula, and finally code). This should simplify conflict resolution
  4. Eliminate all global variables (2 and 3 basically do this)
  5. DP should return code + file where it is stored.

Friday, February 10, 2006

Lection 2 (2/10/06) : Rewriting

Today we will discuss rewriting. Below I will list all relevant resources.

Rewriting in Spiral


Handout: rewriting.txt
Demo transcript: rewriting-demo.txt
Lecture scratchpad: rewriting-scratch.txt

Papers

The main paper on the topic is

Nachum Dershowitz, Jean-Pierre Jouannaud.
Rewrite Systems, (766 citations),
Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics (B), 1990.
(PS.gz) (PS) (PDF)

Other interesting papers in the area:

Narciso Martí-Oliet and José Meseguer.
Rewriting Logic: Roadmap and Bibliography.
(abstract) (BibTeX entry) (gzip'ed Postscript)


José Meseguer.
Research Directions in Rewriting Logic.
Computational Logic, NATO Advanced Study Institute, Marktoberdorf, Germany, 1997. Springer-Verlag, 1998.
(abstract) (BibTeX entry) (gzip'ed Postscript)

Peter Csaba Ölveczky and José Meseguer.
Specifying Real-Time Systems in Rewriting Logic.
In 1st International Workshop on Rewriting Logic and its Applications (WRLA'96).
Electronic Notes in Theoretical Computer Science, Vol. 4. 1996
(abstract) (BibTeX entry) (gzip'ed Postscript)

For additional information refer to the Maude website.

Lecture 1 (12/23/05) : Namespaces

In reality we also went through OOP programming in Spiral. Since we had many new people, last Friday (2/3/06) I had to do a review session on namespaces. I will also have to repeat OOP.

Namespace redesign document is available thru SVN : spiral/doc/namespaces.tex

Status of the namespace redesign : implementation complete, testing .

Lection 0 (12/16/05): Basic GAP syntax and Spiral extensions.

GAP3 Manual : http://www.gap-system.org/Gap3/Doc3/manual.html
The manual is quite big, but of main interest is just the main syntax and data structures, and this part is quite compact. It should take only about 2 hours to become comfortable with GAP. Links to relevant chapters:

Friday, February 03, 2006

Namespace Discussion

---- CURRENT -------
load a (look in spiral/*)
load b (look in spiral/a/*)

inside mystuff
Import(A)

---- MAREK -------
SPIRAL_PATHS = [ "spiral/" ];
Load mystuff (spiral/mystuff/init.g and spiral/mystuff.g)
Include a (spiral/mystuff/a.gi)
Include b (spiral/mystuff/b.gi)
Load mystuff.A (spiral/mystuff/A/init.g)

-- inside mystuff
Import mystuff.A

Welcome to nSpiral

Spiralnotes was taken.