Supporting "intrinsic" functions in a script language

rdo@elt.com (Randy Oxentenko)
Wed, 22 Feb 1995 20:49:44 GMT

          From comp.compilers

Related articles
Supporting "intrinsic" functions in a script language rdo@elt.com (1995-02-22)
| List of all articles for this month |

Newsgroups: comp.compilers
From: rdo@elt.com (Randy Oxentenko)
Keywords: interpreter, design, question, comment
Organization: Electronic Label Technology, Broken Arrow, OK
Date: Wed, 22 Feb 1995 20:49:44 GMT

We are writing a script interpreter to use in conjunction with our
application. The strategy we are using is to compile a script function
into an internal data structure which I refer to as an executable parse
tree. We are using C++, and crafting the parser by hand using a
recursive-descent technique.


We wish to implement support for intrinsic functions unique to our
application by supplying a function-call mechanism capable of calling
internal functions from within our script language. The way we have
devised to do this is to use a different type of expression node in
the parse tree for each type of intrinsic function we want to support.
While this will work, we would like to use a more generic approach that
did not require designing one node for each intrinsic function we want
to support.


Is there a better way to do this? I will follow this group for answers,
but I will also summarize replies I receive by e-mail to post back to
the group. Thanks in advance for any suggestions.
--


Randy Oxentenko Email: rdo@elt.com Compuserve: 74503,1706
[I usually do all of the built-in functions with a single node type with
subtype fields for the number of arguments and the actual function to call.
At runtime it pushes all of the args on the data stack and calls the
function. -John]
--


Post a followup to this message

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