Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to do Algebraic Mode in PS like the HP does?

Received: by 10.180.73.173 with SMTP id m13mr766718wiv.4.1348984648765;
        Sat, 29 Sep 2012 22:57:28 -0700 (PDT)
Path: q11ni104684560wiw.1!nntp.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From: "luser.droog" <luser.dr...@gmail.com>
Newsgroups: comp.lang.postscript
Subject: Re: How to do Algebraic Mode in PS like the HP does?
Date: Sun, 30 Sep 2012 00:57:23 -0500
Organization: unorganized
Lines: 44
Message-ID: <k48n03$98q$1@dont-email.me>
References: <ae22e8f0-ad4a-491d-9255-155b04c7aa66@j25g2000yqn.googlegroups.com> <988c7d8d-49db-4d82-b878-a0466503a0c6@googlegroups.com> <k0b0js$nqu$1@reader1.panix.com> <ef3f384c-2a6e-4850-8286-7d75b4b63179@googlegroups.com> <k3ou4d$c8i$1@reader1.panix.com> <k45r3i$5ki$1@dont-email.me>
Mime-Version: 1.0
Injection-Info: mx04.eternal-september.org; posting-host="744e40ad726a36842c02abb0656cbad1";
	logging-data="9498"; mail-complaints-to="ab...@eternal-september.org";	posting-account="U2FsdGVkX1+krgcHKZn/S+0d94IPCGnd9BBIMB+iJR0="
User-Agent: KNode/0.10.9
Cancel-Lock: sha1:46NMBF5JXDRpThu+d9m93+o2urY=
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit

luser.droog wrote:

> David Combs wrote:
> 
>> In article <ef3f384c-2a6e-4850-8286-7d75b4b63179@googlegroups.com>,
>> luser- -droog  <mijo...@yahoo.com> wrote:
>>>
>>>
>>>I'd suggest you take them one-at-a-time and start posting "How to do XX
>>>in PS like the HP does?" threads. I'll contribute!
>>>
>>>For algebraic mode, we'll need a LL(1) or LR parser. I'll go get my
>>>Dragon book...
>>>
>>>-- droog
>> 
>> 
>> Yes, if it were c, you'd need the lr stuff, I guess.
>> 
>> But just parenthesized expressions and function calls,
>> isn't that basically dead simple?  Recursive descent
>> or the like.  And so unlike an lr scheme, with
>> recursive descent the parsing code is readable and
>> understandable.  (Once someone does the first and
>> follow sets -- sort of beyond me!)
>> 
>> David
> 
> Here's a first draft. Converts a string containing
> an infix expression involving "*_+-" to a string
> containing the postfix equivalent.
> 
> To actually produce PS output, we'll need to expand the
> payload in the /oper dict and pre-scan the string to
> count operators so the size of the output string can
> be calculated.
>
 
A little more searching led me to this:
http://devmaster.net/posts/2866/processing-arithmetic-expressions-with-the-shunting-yard-algorithm

Looks very promising.