|Supporting "intrinsic" functions in a script language email@example.com (1995-02-22)|
|From:||firstname.lastname@example.org (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
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
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: email@example.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
Return to the
Search the comp.compilers archives again.