From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d8e7e976ead4a812 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-16 12:06:26 PST From: "Kai Schuelke" Newsgroups: comp.lang.ada References: <5f4adaeaa2a7b35810acd4e20fb98b25.86200@mygate.mailgate.org> <3ce15027.0@news.unibw-muenchen.de> <3ce2e175.0@news.unibw-muenchen.de> <3CE39A2D.2C75435A@earthlink.net> Subject: Re: Function pointer in Ada? Date: Thu, 16 May 2002 21:06:32 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: bl15-1107.studfb.unibw-muenchen.de Message-ID: <3ce4031e.0@news.unibw-muenchen.de> X-Trace: 16 May 2002 21:06:06 +0100, bl15-1107.studfb.unibw-muenchen.de Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.tele.dk!small.news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-nue1.dfn.de!uni-erlangen.de!lrz.de!news.unibw-muenchen.de!bl15-1107.studfb.unibw-muenchen.de Xref: archiver1.google.com comp.lang.ada:24222 Date: 2002-05-16T21:06:32+02:00 List-Id: 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.