Hi,

I am writing a parrot code generator back-end to an interpreter for a
long-lost (some would say "dead", but I prefer "hibernating" :-)
programming language: Comal (see http://www.josvisser.nl/opencomal).

Anyway, in the course of my code generation I have run into the
situation where I think I need to either:

- Be able to trap a find_lex failure (efficiently), or
- Be able to search the lexical pads for the occurrence of a lexical
  with potentially getting "not found" as a result (I dubbed this
  feature "search_lex").

The reason is that in this language I can create new variables at any
place in the control flow, but referring to an unknown variable should
throw an error. Also, once created and stored in the lexical
environment, I want assignments to a variable to always refer to the
same PMC (because of a language feature that allows call by reference).

So, my questions are:

1)      Is there an efficient way to trap the failure of a "find_lex"?

2)      What about a "search_lex" op that follows the format of
        "find_lex" but which stores null in the target PMC register
        (Px). To make this really useful an "isnull" comparison operator
        would come in handy too...

++Jos.es

-- 
ek is so lug jy vlieg deur my
sonder jou is ek sonder patroon
   "Breyten Breytenbach"

Reply via email to