[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: yacc question, maybe related or very OT
From: |
Hans-Bernhard Broeker |
Subject: |
Re: yacc question, maybe related or very OT |
Date: |
Tue, 25 Nov 2003 12:04:11 +0100 (CET) |
On Tue, 25 Nov 2003, Shayne K wrote:
> but I don't think this is sufficient enough. Or it is and i'm doing
> something wrong. I know the yylineno works, but I would rather fseek to the
> position I want and the yyreset().
I think you're going at this the wrong way. You're planning to re-parse
the function bodies in your script-language type input every time the
function is executed. That's not exactly very efficient.
The canonical way is to store the result of parsing a whole function in
some internal form (a parse tree, or an array of operations encoded by C
function pointers) when you first parse the function (i.e. in the C code
of the yacc rule that has "complete function" on the left side). Then,
whenever that function is to be executed, you execute the *stored*
version.
--
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.