comp.lang.ada
 help / color / mirror / Atom feed
From: "Kai Schuelke" <kai.schuelke@gmx.net>
Subject: Re: Function pointer in Ada?
Date: Thu, 16 May 2002 21:06:32 +0200
Date: 2002-05-16T21:06:32+02:00	[thread overview]
Message-ID: <3ce4031e.0@news.unibw-muenchen.de> (raw)
In-Reply-To: 3CE39A2D.2C75435A@earthlink.net

I took the String a watched for the least significant Operation (binary
operations only at first), which is the root of my tree. I put the left side
of the String onto the left branch, same on the right side, until I get a
remaining number or a variable name.

y = 5*x + 3     becomes

Op:              +
                /        \
Op:        *          3    Num
            /    \
Num:   5    x       Var

Therefore I need a record to describe a leaf that consists of
- 2 pointers to the next leafs
- A storage, that indicates what the leaf is: a operation, a constant or a
variable

I  used:
type LEAF is record
    Left,
    Right : operation_pointer := null    -- thats why I started to post in
this thread
    Con  : FLOAT;
    Var   : BOOLEAN;
end record;

Does anybody see a more ada-like way to do it? Somebody wrote that this is C
style.

Thanks

Kai Schuelke   looking forward to learn something new.

PS: This program works just fine right know, but it is intended to learn
something about Ada. So please don't mind my asking for better ways.








  reply	other threads:[~2002-05-16 19:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-14 12:51 Function pointer in Ada? Henrik Quintel
2002-05-14 13:08 ` Markus Knauss
2002-05-14 13:12 ` Marin David Condic
2002-05-14 14:36 ` Alfred Hilscher
2002-05-14 17:58 ` Kai Schuelke
2002-05-14 18:01   ` Preben Randhol
2002-05-14 18:24   ` David C. Hoos
2002-05-14 20:00     ` Kai Schuelke
2002-05-14 18:25   ` Marin David Condic
2002-05-15 22:30     ` Kai Schuelke
2002-05-16 11:37       ` Marc A. Criley
2002-05-16 19:06         ` Kai Schuelke [this message]
2002-05-16 19:18           ` Preben Randhol
2002-05-16 12:53       ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox