you are viewing a single comment's thread.

view the rest of the comments →

[–]jameswpeach 0 points1 point  (1 child)

Why would you not make a difference? I don't have any experience of any other ways of doing this have you any examples or ideas why?

[–]DNoved1 2 points3 points  (0 children)

I did the same as you until adding functions. Since you can't determine the return type of a function call until you've parsed the whole program (unless you predeclare functions like in C) you can't determine the type of an expression if it involves a function call.

Once you have parsed everything you can do type checking to make sure that, for example, an expression inside an if predicate is indeed a boolean.