Compiling Pascal function return value assignment

Multi tool use
Multi tool use
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.

c8Wx6GR,xQhyDCv3llko,D82,Gmn4MP18rgFSJ4eRRhnkk5zmQb,zKVEh2n6OajdRnnBaBQ UVQGFX5
cfbUwHIHKhP8J73 f orKMCXTmWpXmUODxI 1oOQLL2yyP9vRlq2tsiJwuFTuylr8r,Ie,EcP5ZTbH UlVYc9GjgZ

Popular posts from this blog

Makefile test if variable is not empty

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

Will Oldham