[Aldor-l] Should this "parser" work?

Martin Rubey martin.rubey at univie.ac.at
Mon Oct 23 03:39:00 EDT 2006


Hi Christian,

Btw, what does tmgisi stand for? Sounds nice :-)

"Christian Aistleitner" <tmgisi at gmx.at> writes:

> Hello Martin,
> 
> On Sun, 22 Oct 2006 20:59:05 +0200, Martin Rubey  <martin.rubey at univie.ac.at>
> wrote:
> 
> > However, it just occurred to me that maybe the setup is rather
> >
> > mem loc   depends on            Name / Variable   comment
> >
> > 00001000:                       CC
> >
> > 00002000: 00001000              List CC
> >
> > 00003000:                       Atom
> >
> > 00003001:                                         an instance of Atom
> >
> > 00005000: 00003001 00000000     res               contents pointer
> >
> > 00006000:                                         result of E(1)
> >
> > which would explain what happens.
> 
> I am not yet convinced that such a setup would explain the working of the
> code.  However, I do not think, such a setup is used.
> 
> First of all, what do you mean by “instance of Atom”. Atom is a domain.  For
> the domain MachineInteger, 34 is an instance, just as 35 or 36 are.  But for
> Atom?

I'd think that domains are instantiated, since it may happen that they contain
some local data. But that's a very vague idea. 

> You probably mean “some copy/reference of/to the domain”. But I do not  think,
> something like that happens.

However, I just found the following remark in the AUG:


20.3        Fortran-77 has a fixed and relatively small set of data types, and
            passes all subprogram parameters by reference (i.e. it passes a
Data Corre- pointer to the data rather than a copy of the data). Aldor, on the
spondence   other hand, has a rich and extensible type system, and in general
            will pass copies of subprogram data (at least in simple cases). The
            aim of the interface is to ensure that Foreign functions behave
            naturally in their host environment.

Does this apply to the present situation? I.e., wouldn't this mean, for
instance, that "cons" in

        res: List CC := [];
        for x in p repeat
          res := cons(Atom, res);

will copy "Atom"? (and "res"???)


> Consider the following two lines of code:
> 
> res := cons( MachineInteger, res );
> res := cons( MachineInteger, res );
> 
> When compiling them, the relevant part of the generated C code is
> 
> [...]
> T0_res = fiCCall2(FiWord, l0->X9_cons, l0->X3_MachineInteger,
>           T0_res);
> T0_res = fiCCall2(FiWord, l0->X9_cons, l0->X3_MachineInteger,
>           T0_res);
> [...]
> 
> There are no lines in between. Of course, fiCCall2 could manage to create
> copies of the domain MachineInteger on the fly, but why should it?

Hm, I have no idea currently.


I admire your ability to go down to the core!

Martin





More information about the Aldor-l mailing list