Couldn't we just have an expression evaluator done with PetitParser doing these things?

Tcl and Bash have this expr: thing.


(Expression parse: '5+3*2') value.
(Expression parse: ':a | 5+:a*2') value:10.
(Expression parse: ':a | 5+:a*2') value:self x.

With the thesis of Lukas Renggli these was this Helvetia story.
Is there any chance we see something around these lines now that there is a new compiler thing inside Pharo?

So:

someMethod: anX
<expr>
^ 5 + anX * 2

Phil





On Thu, Jun 26, 2014 at 6:11 PM, Richard Sargent <richard.sargent@gemtalksystems.com> wrote:
Esteban A. Maringolo wrote
> If one thing confuses people in that realm is non arithmetic precedence:
> Eg. 2 + 3 * 4 = 20 instead of the "expected" 14.
>
> And we're not going to change that either. It's not worthy, and I
> doubt if it is possible at all.

I'm probably late to the party with this reply. The primary reason for not
changing this is that it would be incorrect. It comes down to intrinsic
versus extrinsic meaning. A multiple operator has an intrinsic meaning: it
means multiple. But a message name does not have intrinsic meaning (other
than it is a good idea to have the name represent what it does). The meaning
of a message is determined by the receiver. e.g. if PetitParser defines #*
to mean "0 or more repetitions", what happens when someone has decided that
it should be evaluated before #+?

Message sending precedence can only be defined in terms of the type of
message: unary, binary (or infix), and keyword, since the interpretation of
the message is the receiver's responsibility, not the compiler's.




--
View this message in context: http://forum.world.st/about-tp4764892p4765070.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.