help-bison
[Top][All Lists]
Advanced

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

Re: 3DLDF


From: Hans Aberg
Subject: Re: 3DLDF
Date: Sat, 14 Aug 2004 15:36:08 +0200

At 11:03 +0200 2004/08/14, Laurence Finston wrote:
>The information you want is in the manual, starting on page 54.

You do just about what I thought. You could fairly easily make such an
intermediate language, as I suggested. The point is that you, and any
potential users, would be freed from the cumbersome C++ syntax.

There are two approaches: One is that this intermediate language parser is
writing C++ code, which is then compiled. (Such an approach is used for
example by the Haskell compiler GHC. In this approach, one can have a
construct for inclusion of verbatim C++. Then it will not be necessary to
immediately add language constructs for all C++ one might use. (I use this
approach in one program I am writing on. The reason is that I had to write
a lot of repetitious C++ code, not simplifiable within C++ itself. This
work made me suggest Bison having a macro-program for its output; Akim
Demaille then added M4.)

The other is to create these objects dynamically within one program, which
directly then writes the output. Then you will have to work a bit more if
you want to add constructs such as the loops in the example on p. 56. But
this is added in the essential same manner as you already have added the
geometric objects derived from a common class Shape: Add classes for
numbers, boolean values and the loop constructs, and so on, and execute it
after the parsing of a loop segment has been fully parsed.

This is in fact a very effective way to do development, because one easily
expand the language when new classes are added to the hierarchy, and it is
easy to test these features by some simple language code.

Once you have this intermediate language, it will be fairly close to what
is needed to construct your shapes. So if you want to go ahead with a
machine language, that could then probably be done fairly easily.

  Hans Aberg






reply via email to

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