2015-04-23 18:51 GMT+02:00 Jos Koot <[email protected]>: > Long ago I made various parsers (most of them in Fortran or assembler) > for expressions with infix notation. I always used push-down automata with > two or more stacks. Now I am playing with macros in Racket that allow > infix notation embedded in Racket without explicitly using push-down > automata. However, I encounter a contradiction in my desires as explained > below. I have looked at 'Infix expressions for PLT Scheme' available in > planet and made by Jens Axel Søgaard. In his approach a+b is evaluated as > though written as (+ a b). However: > > #lang at-exp scheme > (require (planet soegaard/infix)) > (define a+b 4) > (define a 1) (define b 2) > @${a+b} ; evaluates to 3 > > A Racket variable can contain characters such as +, -, * etc. > This makes @${a+b} confusing > (not necessarily ambiguous, though, depending on syntax and semantics. > > The rule is that operators such as +,-, * behave as operators in infix expressions. My intention was to support identifiers with, say, - in them using bar notation as in |foo-bar| but I never got around to add them.
If one want to allow the usual operators in identifiers without a quoting mechanism, then spaces are need to separate operators and identifiers - which may or may not fell annoying. /Jens Axel -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

