Compiling Pascal function return value assignment

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Compiling Pascal function return value assignment



I'm writing a toy Pascal compiler in Haskell. I can produce a Type-annotated AST.
I've been ignoring function return value assignments:


function foo : integer;
begin
foo := 12
end;



How do I handle those, given that the grammar doesn't distinguish between them and any other regular assignment statement?
Should the AST be modified to specifically highlight a return value assignment?



And how to deal with them in the type checking phase (An environment Symbol table consisting of function signatures and a stack of contexts was enough so far)?





I think the type checking question is probably too broad, and the reason for the close vote. I think the AST question would be good if this question included things like the current AST data structure.
– Carl
28 mins ago





I linked to the ast, it's too clumsy to include it in the question
– BanishedBot
19 mins ago







@Carl Also broad? i'm asking about a very specific thing how is this broad?
– BanishedBot
10 mins ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty