August 17, 2001
John Fletcher wrote in message <3B7D3B82.940D2C16@aston.ac.uk>...
>Sorry, I don't understand. If the front end could specify all its
components in
>terms of existing types, would this difficult apply?  I guess so, since a complex is just two reals.  Could the back end have hooks to make it
easier?


The back end had the concept of only one real at a time. With complex numbers, it had to start dealing with pairs. Also, complex numbers are returned in (ST1,ST0). It wasn't that hard, there were just a lot of permutations, since operands could be any combination of real, imaginary, or complex, all with slightly different semantics. Multiply and divide are implemented with helper functions rather than directly. Etc. Just a lot of details.


August 20, 2001

Walter wrote:

> John Fletcher wrote in message <3B7D3B82.940D2C16@aston.ac.uk>...
> >Sorry, I don't understand. If the front end could specify all its
> components in
> >terms of existing types, would this difficult apply?  I guess so, since a complex is just two reals.  Could the back end have hooks to make it
> easier?
>
> The back end had the concept of only one real at a time. With complex numbers, it had to start dealing with pairs. Also, complex numbers are returned in (ST1,ST0). It wasn't that hard, there were just a lot of permutations, since operands could be any combination of real, imaginary, or complex, all with slightly different semantics. Multiply and divide are implemented with helper functions rather than directly. Etc. Just a lot of details.

I see.  I have the same sort of special cases, only I am handling them at a higher level in the template code. So it would not be that easy to have something which had more than two, because of the register allocations.

John


November 04, 2001
This would be so cool.  So I go onto some cool new machine, that exposes a 64 register stack with 8 doubles each and is just built for doing matrix math, I could take the open source front end and add in some add-on support module code to manipulate (do operations on) some type.  Provide operators and argument types, how to cast it or otherwise construct it from other types, and tell the main compiler what assembly sequences have to be generated to do each operation requested of it.  The code generator could maintain internal state to remember what it had done recently (such as which registers or pseudo-registers it has allocated at that point in execution, what's on the stack where) so it could optimize the code as it goes.

Quite interesting.  BTW a non-optimizing backend is easy... what's hard is writing an optimizing backend.  If you're not worried about the speed of the generated code you can avoid a lot of work.  May be ok for the first D compiler to only generate debug-quality code.

Sean

"Walter" <walter@digitalmars.com> wrote in message news:9lih2t$10ca$1@digitaldaemon.com...
>
> John Fletcher wrote in message <3B7BC551.E9907C61@aston.ac.uk>...

> >If the front end was open source, would it be possible to add new
internal types
> >to it which were compounds of existing types, e.g. quaternion?
>
> Yes. The way it is laid out internally is meant to make it easy to add new built-in types. The difficulty is getting the *back* end to support them.
In
> order to make complex types work, I had to get them to work in the back
end;
> quite a bit of work there.



May 08, 2002
Walter wrote:
> 
> Does the D string design work for you? I don't know SNOBOL or Icon.

Icon uses array slice notation to get at substrings:
  x[2:10]   -- 9 chars selected from x
  x[:10]    -- from the start to position 10
  x[10:]    -- from position 10 to the end

Negative subscripts are treated as offsets from the end of the array, so x[-1] is the last character of x (or thereabouts; I can't remember if subscripts are 0-based or 1-based. If 1-based, then x[0] is the last character and x[-1] the penultimate one).

So (assuming 1-based subscripts) you can get all but the first and
last chars of x using x[2:-1].

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
1 2
Next ›   Last »