From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:7141:: with SMTP id h1mr19675998qtp.211.1610902558416; Sun, 17 Jan 2021 08:55:58 -0800 (PST) X-Received: by 2002:a25:9902:: with SMTP id z2mr29812415ybn.339.1610902558209; Sun, 17 Jan 2021 08:55:58 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 17 Jan 2021 08:55:58 -0800 (PST) In-Reply-To: <7d0f4046-76e7-47ae-ab56-751941fc1a5fn@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <4370e6f1-4504-4dff-8208-e1ad7eeac9a5n@googlegroups.com> <38687765-d3ee-4966-a4e3-c975bd73ceadn@googlegroups.com> <7d0f4046-76e7-47ae-ab56-751941fc1a5fn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <094c6469-f72a-4879-bc17-fcc09d24f837n@googlegroups.com> Subject: Re: ANN: Simple Components v From: Shark8 Injection-Date: Sun, 17 Jan 2021 16:55:58 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2888 Xref: reader02.eternal-september.org comp.lang.ada:61160 List-Id: Dmitry isn't asking about the manner in which you are using prefix-notation= , he's asking what the context (types, operations, etc) you're talking abou= t. In any case, converting between inline/pre-/post-fix operators is trivial: = parse the operations and operands into a structure [typically a binary tree= ], and then walk the tree as needed to produce your desired output. Type Operator is (Add, Sub, Mul, Div); Function Image( Input : Operator ) return String is (case Input is when Add =3D> "+", when Sub =3D> "-", when Mul =3D> "*", when Div =3D> "/", ); Type Simplified_Node( Op : Operator ) is record Left, Right : Integer; end record; Function Inline( Input : Simplified_Node ) return String is ( Input.Left'Image & ' ' & Image(Input.Op) & ' ' & Right'Image ); Function Prefix ( Input : Simplified_Node ) return String is ( Image(Input.Op) & ' ' & Input.Left'Image & ' ' & Right'Image ); Function Postfix( Input : Simplified_Node ) return String is ( Input.Left'Image & ' ' & Right'Image & ' ' & Image(Input.Op) ); In a non-trivial example, the concept above would be equivalent to the expr= ession-parsing definition found in many language. It would also let you hav= e expressions as the Left or Right child, and might even handle precedence,= though there are some languages that even though using inline operators ha= ve strict (usually left-to-right) ordering regardless of the operator.