help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yacc question, maybe related or very OT


From: Shayne K
Subject: Re: yacc question, maybe related or very OT
Date: Tue, 25 Nov 2003 20:09:55 +0000

Thanks Hans

This answers my question and also makes my parser a lot more efficient

- Shayne


From: Hans-Bernhard Broeker <address@hidden>
To: Shayne K <address@hidden>
CC: address@hidden
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.



_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963





reply via email to

[Prev in Thread] Current Thread [Next in Thread]