Re: [racket-users] RE: infix notation embedded in Racket

2015-04-25 Thread Jens Axel Søgaard
2015-04-24 18:32 GMT+02:00 Jens Axel Søgaard jensa...@soegaard.net:



 2015-04-24 18:25 GMT+02:00 Jos Koot jos.k...@gmail.com:

  Hi Jens Axel,

 Thanks for replying and explaining.

 Can you discriminate between a+b and |a+b| or a|+|b?

 When I get around to adding |...| identifiers to the lexer, it will work
 like this:

   a+b   will be parsed as (+ a b)
   |a+b|  as a+b(a single identifier)
   a|+|b  will be passed as (+ a b)


I forgot to mention that the infix reader already reads  foo_bar as foo-bar.
I.e. the most common symbols are easily accessible already.

/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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: infix notation embedded in Racket

2015-04-24 Thread Jens Axel Søgaard
2015-04-23 18:51 GMT+02:00 Jos Koot jos.k...@gmail.com:

  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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: [racket-users] RE: infix notation embedded in Racket

2015-04-24 Thread Jos Koot
Sorry, it was me that was not following.
After looking into your source main.ss I found out how to use macro $.
Looked into some of your other source files too.
Impressive.
Thanks, Jos

 
  _  

From: jensaxelsoega...@gmail.com [mailto:jensaxelsoega...@gmail.com] On
Behalf Of Jens Axel Søgaard
Sent: viernes, 24 de abril de 2015 18:32
To: Jos Koot
Cc: racket-users@googlegroups.com
Subject: Re: [racket-users] RE: infix notation embedded in Racket




2015-04-24 18:25 GMT+02:00 Jos Koot jos.k...@gmail.com:



Hi Jens Axel,
 
Thanks for replying and explaining.
 
Can you discriminate between a+b and |a+b| or a|+|b?


When I get around to adding |...| identifiers to the lexer, it will work
like this:

  a+b   will be parsed as (+ a b)
  |a+b|  as a+b(a single identifier)
  a|+|b  will be passed as (+ a b)


I don't see how without using a language with it's own key-binding for |.



I am not following. The $ macro can be required into any language?. 

/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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] RE: infix notation embedded in Racket

2015-04-24 Thread Jens Axel Søgaard
2015-04-24 18:25 GMT+02:00 Jos Koot jos.k...@gmail.com:

  Hi Jens Axel,

 Thanks for replying and explaining.

 Can you discriminate between a+b and |a+b| or a|+|b?

 When I get around to adding |...| identifiers to the lexer, it will work
like this:

  a+b   will be parsed as (+ a b)
  |a+b|  as a+b(a single identifier)
  a|+|b  will be passed as (+ a b)

I don't see how without using a language with it's own key-binding for |.


I am not following. The $ macro can be required into any language?.

/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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] RE: infix notation embedded in Racket

2015-04-24 Thread Jos Koot
Hi Jens Axel,
 
Thanks for replying and explaining.
 
Can you discriminate between a+b and |a+b| or a|+|b?
I don't see how without using a language with it's own key-binding for |.
 
I prefer my infix to be usable without forcing the user to go into a
specific language. For the moment I use spaces. As ugly that I probably are
not going to use my own infix :) Allowing spaces to be omitted restricts the
names of variables too much deviating from Racket, imho. As I wrote before,
I am just playing with a parser without explicit use of a push down
automaton. So far my experience is that this is very well possible, in fact
much easier.
 
Thanks again, Jos
 

 
  _  

From: jensaxelsoega...@gmail.com [mailto:jensaxelsoega...@gmail.com] On
Behalf Of Jens Axel Søgaard
Sent: viernes, 24 de abril de 2015 14:50
To: Jos Koot
Cc: racket-users@googlegroups.com
Subject: Re: infix notation embedded in Racket


2015-04-23 18:51 GMT+02:00 Jos Koot jos.k...@gmail.com:



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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.