[M3devel] "looping to get all types declared first"
Tony Hosking
hosking at cs.purdue.edu
Sun Oct 31 17:48:58 CET 2010
I don't understand the purpose of all this. Can't you just maintain one global table mapping type id to type?
On Oct 31, 2010, at 12:43 AM, Jay K wrote:
>
> There is this "replay" thing I put in the backend.
> It isn't quite right.
>
>
> I would like to have multiple passes, where if
> all the types haven't been declared yet, non-type-declaration
> operations do nothing.
>
> There are approximately three approaches.
>
> 1) the frontend front-loads all type declarations
> so as soon as non-type declaration seen, that is the end,
> ok to loop; I don't know if this is true.
>
>
> 2) in each operand implementation, check if all the types
> have been declared yet and if not and if the operation
> isn't a declaration, immediately return
> This isn't entirely true. Some things like begin unit/procedure/block
> need to do anything, to track lexical location for building
> prefixes on type names, or somesuch.
>
> Actually, I think all the type data structures might need
> to be in a linked list going from inner scope to outer scope
> and searches have to search them in order and take the first hit. ?
>
>
> 3) or, similarly, but the question is, do we loop
> over the serialized form, or do we first deserialize
> into an in-memory form, and then loop over that?
>
>
> Those are my main questions:
> a) does the front end front-load declarations? I can trace a bit in cm3cg and guess.
> b) if not, do people prefer multiple passes over the serialized form or
> first deserialize into an in-memory form, and then loop over that
> c) change frontend to front-load declarations
>
>
> My preference is b.
> It is isn't the most efficient, but the efficiency should be plenty adequate.
>
>
> I understand typeids are hashes, so scope is sort of irrelevant.
> But typenames specifically are scoped.
>
>
> - Jay
More information about the M3devel
mailing list