public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* unrecognized syntax: type[args]
@ 2023-10-07 15:02 Damien Mattei
  2023-10-07 15:34 ` Per Bothner
  0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2023-10-07 15:02 UTC (permalink / raw)
  To: kawa mailing list

#|kawa:11|# (define (copy-stepped-slice container-eval expr-eval i1 i2 step)
#|.....12|#
#|.....13|#   (when (= step 0)
#|.....14|#     (error "assignment : slice step cannot be zero"))
#|.....15|#
#|.....16|#   (<+ i 0)
#|.....17|#
#|.....18|#   (if (< step 0) ;; with negative index we start at end of
vector (like in Python)
#|.....19|#       (for ((<+ k i2) (>= k i1) (<- k (+ k step)))
#|.....20|#        (<- ($bracket-apply$ container-eval k)
($bracket-apply$ expr-eval i))
#|.....21|#        (<- i (+ i 1)))
#|.....22|#
#|.....23|#       (for ((<+ k i1) (< k i2) (<- k (+ k step)))
#|.....24|#        (<- ($bracket-apply$ container-eval k)
($bracket-apply$ expr-eval i))
#|.....25|#        (<- i (+ i 1)))))
/dev/tty:20:44: unrecognized syntax: type[args]
/dev/tty:24:44: unrecognized syntax: type[args]


what does it means?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-07 15:02 unrecognized syntax: type[args] Damien Mattei
@ 2023-10-07 15:34 ` Per Bothner
  2023-10-07 16:30   ` Damien Mattei
  0 siblings, 1 reply; 9+ messages in thread
From: Per Bothner @ 2023-10-07 15:34 UTC (permalink / raw)
  To: Damien Mattei, kawa mailing list



On 10/7/23 08:02, Damien Mattei via Kawa wrote:

> #|.....19|#       (for ((<+ k i2) (>= k i1) (<- k (+ k step)))
> #|.....20|#        (<- ($bracket-apply$ container-eval k)
> ($bracket-apply$ expr-eval i))
> #|.....25|#        (<- i (+ i 1)))))
> /dev/tty:20:44: unrecognized syntax: type[args]
> /dev/tty:24:44: unrecognized syntax: type[args]
> 
> 
> what does it means?

It is referring to the ($bracket-apply$ container-eval k) and
($bracket-apply$ expr-eval i) which are de-sugarings of
container-eval[k] and expr-eval[i].

Specifically, container-eval and expr-eval are not valid known types.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-07 15:34 ` Per Bothner
@ 2023-10-07 16:30   ` Damien Mattei
  2023-10-07 16:34     ` Damien Mattei
  0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2023-10-07 16:30 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

yes it it what i'm understanding:

 $bracket-apply$
#<syntax <unnamed>>

so Kawa already use $bracket-apply$ ,part of SRFI 105 but where is it
documented i have to deal with that in relation with use i do within
my code (i can of course rename $bracket-apply$ as i control the
reader now...)

lot of thing to understand before action....

On Sat, Oct 7, 2023 at 5:35 PM Per Bothner <per@bothner.com> wrote:
>
>
>
> On 10/7/23 08:02, Damien Mattei via Kawa wrote:
>
> > #|.....19|#       (for ((<+ k i2) (>= k i1) (<- k (+ k step)))
> > #|.....20|#        (<- ($bracket-apply$ container-eval k)
> > ($bracket-apply$ expr-eval i))
> > #|.....25|#        (<- i (+ i 1)))))
> > /dev/tty:20:44: unrecognized syntax: type[args]
> > /dev/tty:24:44: unrecognized syntax: type[args]
> >
> >
> > what does it means?
>
> It is referring to the ($bracket-apply$ container-eval k) and
> ($bracket-apply$ expr-eval i) which are de-sugarings of
> container-eval[k] and expr-eval[i].
>
> Specifically, container-eval and expr-eval are not valid known types.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-07 16:30   ` Damien Mattei
@ 2023-10-07 16:34     ` Damien Mattei
  2023-10-07 16:42       ` Per Bothner
  0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2023-10-07 16:34 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

i understand that in kawa there is an immediate evaluation of $bracket-apply$
but here i'm using $bracket-apply$ as a procedure (was a macro in the
past) that will be evaluated later at a point container-eval and
expr-eval are known.

And container-eval and expr-eval are not type in my code but variable
that could be vector,string,hash-table,arrays.... all that could be
indexing by one or more indexes.... [ ] as operator....

On Sat, Oct 7, 2023 at 6:30 PM Damien Mattei <damien.mattei@gmail.com> wrote:
>
> yes it it what i'm understanding:
>
>  $bracket-apply$
> #<syntax <unnamed>>
>
> so Kawa already use $bracket-apply$ ,part of SRFI 105 but where is it
> documented i have to deal with that in relation with use i do within
> my code (i can of course rename $bracket-apply$ as i control the
> reader now...)
>
> lot of thing to understand before action....
>
> On Sat, Oct 7, 2023 at 5:35 PM Per Bothner <per@bothner.com> wrote:
> >
> >
> >
> > On 10/7/23 08:02, Damien Mattei via Kawa wrote:
> >
> > > #|.....19|#       (for ((<+ k i2) (>= k i1) (<- k (+ k step)))
> > > #|.....20|#        (<- ($bracket-apply$ container-eval k)
> > > ($bracket-apply$ expr-eval i))
> > > #|.....25|#        (<- i (+ i 1)))))
> > > /dev/tty:20:44: unrecognized syntax: type[args]
> > > /dev/tty:24:44: unrecognized syntax: type[args]
> > >
> > >
> > > what does it means?
> >
> > It is referring to the ($bracket-apply$ container-eval k) and
> > ($bracket-apply$ expr-eval i) which are de-sugarings of
> > container-eval[k] and expr-eval[i].
> >
> > Specifically, container-eval and expr-eval are not valid known types.
> > --
> >         --Per Bothner
> > per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-07 16:34     ` Damien Mattei
@ 2023-10-07 16:42       ` Per Bothner
  2023-10-07 16:59         ` Damien Mattei
  0 siblings, 1 reply; 9+ messages in thread
From: Per Bothner @ 2023-10-07 16:42 UTC (permalink / raw)
  To: Damien Mattei; +Cc: kawa mailing list

In Kawa $bracked-apply$ is a pre-defined macro - but it is not hard-wired.
You can re-bind it to something else.  You probably should.
Either that, or change the reader to conervt foo[args] to something different.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-07 16:42       ` Per Bothner
@ 2023-10-07 16:59         ` Damien Mattei
  2023-10-08  8:11           ` Damien Mattei
  0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2023-10-07 16:59 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

yes it is what i was understanding and verifying:

https://www.gnu.org/software/kawa/tutorial/Types.html


|kawa:21|# (define x (int[] 1 2 3))
#|kawa:22|# x
[1 2 3]

i discover that:
#|kawa:23|# (define x (($bracket-apply$ int) 1 2 3))
#|kawa:24|# x
[1 2 3]

yes i can redefining , that was in my code , but it fails, probably
one of my definition used it before redefinition , i will test that
and in the worse case use another keyword than  $bracket-apply$ when
curly-infix2prefix.scm parse the [ ] and convert it in prefix....

On Sat, Oct 7, 2023 at 6:42 PM Per Bothner <per@bothner.com> wrote:
>
> In Kawa $bracked-apply$ is a pre-defined macro - but it is not hard-wired.
> You can re-bind it to something else.  You probably should.
> Either that, or change the reader to conervt foo[args] to something different.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-07 16:59         ` Damien Mattei
@ 2023-10-08  8:11           ` Damien Mattei
  2023-10-08  9:02             ` Damien Mattei
  0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2023-10-08  8:11 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

it is hard to modify without touching or breaking deeply the kawa code
or my code because $bracket-apply$ is coded in java in
BracketApply.java
do you know a way to rename $bracket-apply$ it. The standart scheme
way i know does not work, the cause seems to be that it is java behind
, it is not a macro ,not a procedure:
#|kawa:9|# $bracket-apply$
#<syntax <unnamed>>
i ideally want to rewrite $bracket-apply$ and be able to reuse in it
the code of the previous definition of $bracket-apply$....

first problem is to rename this "object" $bracket-apply$ in kawa ?

On Sat, Oct 7, 2023 at 6:59 PM Damien Mattei <damien.mattei@gmail.com> wrote:
>
> yes it is what i was understanding and verifying:
>
> https://www.gnu.org/software/kawa/tutorial/Types.html
>
>
> |kawa:21|# (define x (int[] 1 2 3))
> #|kawa:22|# x
> [1 2 3]
>
> i discover that:
> #|kawa:23|# (define x (($bracket-apply$ int) 1 2 3))
> #|kawa:24|# x
> [1 2 3]
>
> yes i can redefining , that was in my code , but it fails, probably
> one of my definition used it before redefinition , i will test that
> and in the worse case use another keyword than  $bracket-apply$ when
> curly-infix2prefix.scm parse the [ ] and convert it in prefix....
>
> On Sat, Oct 7, 2023 at 6:42 PM Per Bothner <per@bothner.com> wrote:
> >
> > In Kawa $bracked-apply$ is a pre-defined macro - but it is not hard-wired.
> > You can re-bind it to something else.  You probably should.
> > Either that, or change the reader to conervt foo[args] to something different.
> > --
> >         --Per Bothner
> > per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-08  8:11           ` Damien Mattei
@ 2023-10-08  9:02             ` Damien Mattei
  2023-10-08  9:15               ` Damien Mattei
  0 siblings, 1 reply; 9+ messages in thread
From: Damien Mattei @ 2023-10-08  9:02 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

nothing is perfect but i have a solution,i do not know all the non
R*RS syntax special features of kawa, i will assume type[] will have
to be replaced in a program in Kawa by ($bracket-apply$ type) to use
this feature, also a vector as [1 2 3] should be written #(1 2 3) .
This is not a big deal. Because my curly-infix2prefix parser can not
deal with those syntax, they conflict with SRFI 105.
After in my code i need to replace $bracket-apply$ that is already use
in Kawa by bracket-apply for example (also in my code $bracket-apply$
is a procedure and it is incompatible with type that must not be
evaluated as argument and i do not want to go back when
$bracket-apply$ was a macro in my code). Those modifications will not
touch the Kawa source code ,only my code and still preserve SRFI 105
features and i hope all Kawa special syntax features as my
reader-parser is external to Kawa.(i also writing an optimiser that
act before the code is pass to the scheme compiler as Scheme+ create a
lot of slow down that can be  optimize before, especially infix with
precedence parsing could be done before compilation and not at runtime
but this is not special to kawa but to all scheme implementation of
scheme+)

On Sun, Oct 8, 2023 at 10:11 AM Damien Mattei <damien.mattei@gmail.com> wrote:
>
> it is hard to modify without touching or breaking deeply the kawa code
> or my code because $bracket-apply$ is coded in java in
> BracketApply.java
> do you know a way to rename $bracket-apply$ it. The standart scheme
> way i know does not work, the cause seems to be that it is java behind
> , it is not a macro ,not a procedure:
> #|kawa:9|# $bracket-apply$
> #<syntax <unnamed>>
> i ideally want to rewrite $bracket-apply$ and be able to reuse in it
> the code of the previous definition of $bracket-apply$....
>
> first problem is to rename this "object" $bracket-apply$ in kawa ?
>
> On Sat, Oct 7, 2023 at 6:59 PM Damien Mattei <damien.mattei@gmail.com> wrote:
> >
> > yes it is what i was understanding and verifying:
> >
> > https://www.gnu.org/software/kawa/tutorial/Types.html
> >
> >
> > |kawa:21|# (define x (int[] 1 2 3))
> > #|kawa:22|# x
> > [1 2 3]
> >
> > i discover that:
> > #|kawa:23|# (define x (($bracket-apply$ int) 1 2 3))
> > #|kawa:24|# x
> > [1 2 3]
> >
> > yes i can redefining , that was in my code , but it fails, probably
> > one of my definition used it before redefinition , i will test that
> > and in the worse case use another keyword than  $bracket-apply$ when
> > curly-infix2prefix.scm parse the [ ] and convert it in prefix....
> >
> > On Sat, Oct 7, 2023 at 6:42 PM Per Bothner <per@bothner.com> wrote:
> > >
> > > In Kawa $bracked-apply$ is a pre-defined macro - but it is not hard-wired.
> > > You can re-bind it to something else.  You probably should.
> > > Either that, or change the reader to conervt foo[args] to something different.
> > > --
> > >         --Per Bothner
> > > per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unrecognized syntax: type[args]
  2023-10-08  9:02             ` Damien Mattei
@ 2023-10-08  9:15               ` Damien Mattei
  0 siblings, 0 replies; 9+ messages in thread
From: Damien Mattei @ 2023-10-08  9:15 UTC (permalink / raw)
  To: Per Bothner; +Cc: kawa mailing list

and anyway,in scheme+ , in future all the SRFI-105 converter to scheme
will be done outside the scheme implementation ,even if there exist
already a srfi-105 implementation for a particular scheme because the
optimisation must be done before compilation the process will be:

curly-infix-neoteric -> scheme prefix -> optimiser for $bracket-apply$
,$nfx$,... -> scheme compiler (kawa,racket,guile,bigloo....)

and this solve the problem of the scheme implementation that rarely
implement SRFI105

note that the optimiser i'm currently writing is in scheme and as it
is external i can write it any scheme, Kawa for example or racket or
guile , and use it with another scheme+ implementation (guile or
racket)

On Sun, Oct 8, 2023 at 11:02 AM Damien Mattei <damien.mattei@gmail.com> wrote:
>
> nothing is perfect but i have a solution,i do not know all the non
> R*RS syntax special features of kawa, i will assume type[] will have
> to be replaced in a program in Kawa by ($bracket-apply$ type) to use
> this feature, also a vector as [1 2 3] should be written #(1 2 3) .
> This is not a big deal. Because my curly-infix2prefix parser can not
> deal with those syntax, they conflict with SRFI 105.
> After in my code i need to replace $bracket-apply$ that is already use
> in Kawa by bracket-apply for example (also in my code $bracket-apply$
> is a procedure and it is incompatible with type that must not be
> evaluated as argument and i do not want to go back when
> $bracket-apply$ was a macro in my code). Those modifications will not
> touch the Kawa source code ,only my code and still preserve SRFI 105
> features and i hope all Kawa special syntax features as my
> reader-parser is external to Kawa.(i also writing an optimiser that
> act before the code is pass to the scheme compiler as Scheme+ create a
> lot of slow down that can be  optimize before, especially infix with
> precedence parsing could be done before compilation and not at runtime
> but this is not special to kawa but to all scheme implementation of
> scheme+)
>
> On Sun, Oct 8, 2023 at 10:11 AM Damien Mattei <damien.mattei@gmail.com> wrote:
> >
> > it is hard to modify without touching or breaking deeply the kawa code
> > or my code because $bracket-apply$ is coded in java in
> > BracketApply.java
> > do you know a way to rename $bracket-apply$ it. The standart scheme
> > way i know does not work, the cause seems to be that it is java behind
> > , it is not a macro ,not a procedure:
> > #|kawa:9|# $bracket-apply$
> > #<syntax <unnamed>>
> > i ideally want to rewrite $bracket-apply$ and be able to reuse in it
> > the code of the previous definition of $bracket-apply$....
> >
> > first problem is to rename this "object" $bracket-apply$ in kawa ?
> >
> > On Sat, Oct 7, 2023 at 6:59 PM Damien Mattei <damien.mattei@gmail.com> wrote:
> > >
> > > yes it is what i was understanding and verifying:
> > >
> > > https://www.gnu.org/software/kawa/tutorial/Types.html
> > >
> > >
> > > |kawa:21|# (define x (int[] 1 2 3))
> > > #|kawa:22|# x
> > > [1 2 3]
> > >
> > > i discover that:
> > > #|kawa:23|# (define x (($bracket-apply$ int) 1 2 3))
> > > #|kawa:24|# x
> > > [1 2 3]
> > >
> > > yes i can redefining , that was in my code , but it fails, probably
> > > one of my definition used it before redefinition , i will test that
> > > and in the worse case use another keyword than  $bracket-apply$ when
> > > curly-infix2prefix.scm parse the [ ] and convert it in prefix....
> > >
> > > On Sat, Oct 7, 2023 at 6:42 PM Per Bothner <per@bothner.com> wrote:
> > > >
> > > > In Kawa $bracked-apply$ is a pre-defined macro - but it is not hard-wired.
> > > > You can re-bind it to something else.  You probably should.
> > > > Either that, or change the reader to conervt foo[args] to something different.
> > > > --
> > > >         --Per Bothner
> > > > per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-08  9:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-07 15:02 unrecognized syntax: type[args] Damien Mattei
2023-10-07 15:34 ` Per Bothner
2023-10-07 16:30   ` Damien Mattei
2023-10-07 16:34     ` Damien Mattei
2023-10-07 16:42       ` Per Bothner
2023-10-07 16:59         ` Damien Mattei
2023-10-08  8:11           ` Damien Mattei
2023-10-08  9:02             ` Damien Mattei
2023-10-08  9:15               ` Damien Mattei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).