help-bison
[Top][All Lists]
Advanced

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

Re: Re: calculator with additional function


From: Hans Aberg
Subject: Re: Re: calculator with additional function
Date: Sat, 11 Jun 2005 14:53:12 +0200

[Please keep the CC to Help-Bison, so that others may help.]

I only use C++. There, in one case, I built polymorphic (virtual) class hierarchy, where the classes have a function evaluate(), which can be called, once the closure has been built. The method of outputting C and then compile it, I think is used by the Haskell <http://haskell.org> compiler GHC. It has also an interpreter, as well as Hugs <http://haskell.org/hugs>. In the latter case, it generates some kind of byte code, which is then passed onto an evaluator engine, which performs the looping. Those are big programs. But you have threshold to step over, anyway.

At 14:35 +0200 2005/06/11, address@hidden wrote:
I can use FLEX and C only.
Could you give example of code how it shoud looks?


Hi,

There was problem with sent my message so I send it again.
I need to write calculator with additional function. It have to
serve loop FOR where I declare how many times it will run and what
will it do inside.
My problem is how to bould data structure (it have to be tree) for
this calculator.
Have You any idea?

You have to build a "closure", that can be executed later, building
it directly in the actions, in terms of code that can executed after
the syntactic termination of the loop. This code can be binary, or an
output in some other language that can be compiled and executed
later. Most do it directly, by hand, perhaps invoking M4, Guile, or
something, as an aid if the output is any other language. Just a few
days ago, there has come to my attention the tool
<http://www.codeworker.org>, probably useful for more advanced things.
--
   Hans Aberg



--
  Hans Aberg




reply via email to

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