Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!news.iecc.com!.POSTED!nerds-end From: noitalmost Newsgroups: comp.compilers Subject: Is multi-level function return possible? Date: Mon, 10 Mar 2014 15:46:31 -0400 Organization: Compilers Central Lines: 13 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-020@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: miucha.iecc.com 1394492396 24819 64.57.183.58 (10 Mar 2014 22:59:56 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Mon, 10 Mar 2014 22:59:56 +0000 (UTC) Keywords: code, history Posted-Date: 10 Mar 2014 18:59:55 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1142 Is this a doable thing for a Pascal-like language that is meant to be compiled? I have a multi-level break which works within a procedure, but the return across procedure boundaries seems to add a lot of complications. I don't recall this being discussed in the dragon book, perhaps because it's just a silly idea. But implementing the multi-level break got me curious whether it's possible. [Sure, you can do it. PL/I let you jump out of a routine and I think Algol60 may have, too. You just need to keep your stack frames sufficiently linked so that you can find the one you want and unwind everything below it. Look at the way Algol and Pascal reference variables in blocks outside the current routine and you'll get most of what you need. -John]