Re: Incorporating run-time error handline in code generation

Arargh! <Arargh@Arargh.com>
22 Dec 2001 22:57:54 -0500

          From comp.compilers

Related articles
Incorporating run-time error handline in code generation jdm1intx@DIE_SPAMBOT_DIEairmail.net (jdm) (2001-12-20)
Re: Incorporating run-time error handline in code generation bonzini@gnu.org (Paolo Bonzini) (2001-12-22)
Re: Incorporating run-time error handline in code generation Arargh@Arargh.com (Arargh!) (2001-12-22)
Re: Incorporating run-time error handline in code generation vbdis@aol.com (2001-12-22)
| List of all articles for this month |

From: Arargh! <Arargh@Arargh.com>
Newsgroups: comp.compilers
Date: 22 Dec 2001 22:57:54 -0500
Organization: Arargh!!
References: 01-12-106
Keywords: errors
Posted-Date: 22 Dec 2001 22:57:54 EST

On 20 Dec 2001 00:42:48 -0500, "jdm"
<jdm1intx@DIE_SPAMBOT_DIEairmail.net> wrote:


>I have most of the standard texts on compiler building. They all go
>into great detail about parsing, scanning, code generation, and so
>forth, but leave out the details on how to handle *run-time* errors.
>Compile-time errors are no problem.
>
>For example, the various flavors of Microsoft Basics have the "On
>Error Goto" construct and the Err object. How much of that is part of
>the runtime library, and how much is part of code generation ? Is
>there a website or book that has more comprehensive information on
>this subject?
>
>John Morrison
>[Good question. I can't think of a place where it's all written down.


I wrote a replacement run-time library for MS BASIC PDS 7.1 some years
ago. In the process I learned a good deal about run-time error
handling. Re the above questions:


'ON ERROR GOTO' stores the address of the goto label in a global
variable. On most RT errors, the global var is checked, and if set,
program execution resumes at that location. Not all errors are
trapable this way.


'ON ERROR GOTO 0' clears the global var.


These apply to the whole program.


There are also 'ON LOCAL ERROR GOTO' & 'ON LOCAL ERROR GOTO 0' which
only apply to the current sub or function, and supersede the global
versions.


The 'ERR' object is a function which returns the current value of
another global variable. Somewhat like C's '_errno'.


It is actually somewhat more complex that the above description would
lead you to believe.


--
Arargh (at arargh dot com) http://www.arargh.com


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.