[ prog / sol / mona ]

prog


new language

8 2021-06-04 12:10

Update on this.

I am working on the tree visitation algorithm now. So basically part of type checking to make sure typed entities that use class type reference classes that are able to be declared - getting rid of loops.

It will only really get to that interesting stuff as soon as I do expression type checking.

As then I can have an example like

int j = obj.k;

class obj
{
   static int k = j;
}

So here the type of the variable j is int, that is fine, no further checking as it is a built-in type (if it was a class type then my code from today applies however I am talking about something different here).

What I should actually be doing here is checking the expression. Then evaluating it and see what it refers to, oh a class, then you type check the class including that static entry which also has an expression and then you have to got back. Now visitation is used for a different case, what I might need here is to rather add an additional atrribute known as `mark` (or ready-to-reference), that should be false here for that variable as we are still parsing the expression, then if we loop back and see that the variable's expression is not ready to reference we error. Technically I need not just a visitatio tree (for a differrent example) but also a r-t-r tree as it can have multiple indirections.

A lot of work but I have am idea of what to do. Also I do have a precedence thing added. That is preprocessed in the sense that I don't do it whilst type checking I do it before it starts, it will reshuffle entries as classes, functions, variables (at global level) and also within containers such as classes. This means that the whole precedence of initialization is implicit when I am doing (or todo the abive).

----

The visitation thing is a tad different, I think that is only useful for when you are doing type-of-variable checking (which is what I did today - not avriable expression checking).

I wrote out a lot more, but I should provide a url probably, like to the post itself, I been jotting them down as of late.

10


VIP:

do not edit these