unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* rackets syntax parse
@ 2012-01-22 22:38 Stefan Israelsson Tampe
  2012-01-25 20:37 ` Stefan Israelsson Tampe
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Israelsson Tampe @ 2012-01-22 22:38 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

Hi All,

I just want to announce the port of racket's syntax-parse that I host at,

https://gitorious.org/guile-syntax-parse/guile-syntax-parse (LGPL v.2)

To run it you will need syntax-local-binding (stable-2.0) which may or may
not be released with the next
upcoming version of guile.

It remains to write a huge test suite and probably to fix a large number of
remaining bugs but still
it is now in such a shape that one can play with it. Please do and help me
improve the port by
finding bugs.

Documentation can be found at,
http://docs.racket-lang.org/syntax/Parsing_Syntax.html

Regards
Stefan

[-- Attachment #2: Type: text/html, Size: 856 bytes --]

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

* rackets syntax parse
  2012-01-22 22:38 rackets syntax parse Stefan Israelsson Tampe
@ 2012-01-25 20:37 ` Stefan Israelsson Tampe
  2012-01-26 11:36   ` Andy Wingo
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Israelsson Tampe @ 2012-01-25 20:37 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

I got it working with an old version of guile but have problem with newest
stable-2.0

I'll expand a macro #'(pk (syntax z)) and when evaluating this I get


(#(syntax-object z ((m~TFEL$Gaj1u5PPt2i@IPCm top)
#(ribcage () () ())
#(ribcage () () ())
#(ribcage () () ())
#(ribcage #(#{ g~TFEL$Gaj1u5PPt2i@IPCp}# #{ g~TFEL$Gaj1u5PPt2i@IPCq}#)
            #((m~TFEL$Gaj1u5PPt2i@IPCr top) (m~TFEL$Gaj1u5PPt2i@IPCr top))
#("o4" "o5"))
#(ribcage () () ())
shift
#(ribcage () () ())
#(ribcage () () ())
#(ribcage () () ())
#(ribcage #(z) #((m~TFEL$Gaj1u5PPt2i@IPCX top)) #("o2"))
#(ribcage () () ())
#(ribcage () () ())
#(ribcage () () ())
#(ribcage () () ())
#(ribcage () () ())
#(ribcage () () ())) (hygiene guile-user)))

There is a binding z that comes from a with-syntax but it does not flow
through!!
Is it because of the shift in the middle?

Anyway I managed to make it work with earlier versions of psyntax but have
hard time to make it works
with current 2.0.

Again the main issue is that guile psyntax does not support the #s notation
in racket and hence the
hacks on the syntax objects. (see the series of emails that I send previous
week)

/Stefan

[-- Attachment #2: Type: text/html, Size: 1333 bytes --]

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

* Re: rackets syntax parse
  2012-01-25 20:37 ` Stefan Israelsson Tampe
@ 2012-01-26 11:36   ` Andy Wingo
  2012-01-27 21:13     ` Stefan Israelsson Tampe
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Wingo @ 2012-01-26 11:36 UTC (permalink / raw)
  To: Stefan Israelsson Tampe; +Cc: guile-devel

On Wed 25 Jan 2012 21:37, Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:

> I got it working with an old version of guile but have problem with newest
> stable-2.0

What version did you get it working with?  In a year there have only
been 25 commits to psyntax, and none of them should have changed
anything fundamental.

> Again the main issue is that guile psyntax does not support the #s notation in racket and hence the
> hacks on the syntax objects. (see the series of emails that I send previous week)

I'll look again.

Andy
-- 
http://wingolog.org/



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

* Re: rackets syntax parse
  2012-01-26 11:36   ` Andy Wingo
@ 2012-01-27 21:13     ` Stefan Israelsson Tampe
  2012-02-04 20:31       ` Stefan Israelsson Tampe
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Israelsson Tampe @ 2012-01-27 21:13 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]

OK,

I have skiped the usage of structs to store data and just use clever lists
with similar api
as the structs so that syntax information can be pushed down to it. With
this I get a lot of
things working again and the codebase is much cleaner. I no longer do uggly
hack with
the syntax representation. The only caveat is some usage of
syntax-local-binding.

Regards
Stefan

On Thu, Jan 26, 2012 at 12:36 PM, Andy Wingo <wingo@pobox.com> wrote:

> On Wed 25 Jan 2012 21:37, Stefan Israelsson Tampe <stefan.itampe@gmail.com>
> writes:
>
> > I got it working with an old version of guile but have problem with
> newest
> > stable-2.0
>
> What version did you get it working with?  In a year there have only
> been 25 commits to psyntax, and none of them should have changed
> anything fundamental.
>
> > Again the main issue is that guile psyntax does not support the #s
> notation in racket and hence the
> > hacks on the syntax objects. (see the series of emails that I send
> previous week)
>
> I'll look again.
>
> Andy
> --
> http://wingolog.org/
>

[-- Attachment #2: Type: text/html, Size: 1574 bytes --]

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

* Re: rackets syntax parse
  2012-01-27 21:13     ` Stefan Israelsson Tampe
@ 2012-02-04 20:31       ` Stefan Israelsson Tampe
  2012-02-07 21:37         ` Andy Wingo
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Israelsson Tampe @ 2012-02-04 20:31 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

Hi all,

Things is going well with syntax parse and the part working is continuously
increasing

One question that I now struggeling is this.

I have a macro expansion that looks like

#'(begin
     (define f fkn-definition)
     (define-syntax name
         (make-syntax-case-transformer
               (make-stxclass
                     ...
                     (datum->syntax #'name 'f)
                     ...))))

This code expans ok in the toplevel. But if expanded elsewhere in definition
context f is not reached from the data associated with the macro. On the
other
hand if we used #'f in stead of (datum->syntax ...)  it will work in the
definitial context
of  for example a lambda but then it can happen that we loose the reference
if expanded into
toplevel. So how can I make this to work in both contexts? do I need to
introduce
e.g. with-syntaxclass ?

Regards
Stefan

P.S. if anyone have a examples of syntax-parse usage please let me now. D.S.

[-- Attachment #2: Type: text/html, Size: 1084 bytes --]

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

* Re: rackets syntax parse
  2012-02-04 20:31       ` Stefan Israelsson Tampe
@ 2012-02-07 21:37         ` Andy Wingo
  2012-02-07 21:58           ` Stefan Israelsson Tampe
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Wingo @ 2012-02-07 21:37 UTC (permalink / raw)
  To: Stefan Israelsson Tampe; +Cc: guile-devel

On Sat 04 Feb 2012 21:31, Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:

> #'(begin
>      (define f fkn-definition)
>      (define-syntax name
>          (make-syntax-case-transformer
>                (make-stxclass
>                      ...
>                      (datum->syntax #'name 'f)
>                      ...))))
>
> This code expans ok in the toplevel. But if expanded elsewhere in definition
> context f is not reached from the data associated with the macro.

So, a few things.

One is that if #'name came from the macro invocation but f did not, then
indeed f is not visible from #'name.

That this works at the top level is a byproduct of a bug in stable-2.0
that is "fixed" in master.  (There are two bugs: one about module
scoping of introduced toplevel identifiers, and another about the
symbolic names of introduced toplevel identifiers.  See
https://savannah.gnu.org/bugs/?31472.)

> So how can I make this to work in both contexts?

Just use #'f instead of (datum->syntax #'name 'f).

Cheers,

Andy
-- 
http://wingolog.org/



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

* Re: rackets syntax parse
  2012-02-07 21:37         ` Andy Wingo
@ 2012-02-07 21:58           ` Stefan Israelsson Tampe
  2012-02-07 22:55             ` Andy Wingo
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Israelsson Tampe @ 2012-02-07 21:58 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]

On Tue, Feb 7, 2012 at 10:37 PM, Andy Wingo <wingo@pobox.com> wrote:

> On Sat 04 Feb 2012 21:31, Stefan Israelsson Tampe <stefan.itampe@gmail.com>
> writes:
>
> > #'(begin
> >      (define f fkn-definition)
> >      (define-syntax name
> >          (make-syntax-case-transformer
> >                (make-stxclass
> >                      ...
> >                      (datum->syntax #'name 'f)
> >                      ...))))
> >
> > This code expans ok in the toplevel. But if expanded elsewhere in
> definition
> > context f is not reached from the data associated with the macro.
>
> So, a few things.
>
> One is that if #'name came from the macro invocation but f did not, then
> indeed f is not visible from #'name.
>
> That this works at the top level is a byproduct of a bug in stable-2.0
> that is "fixed" in master.  (There are two bugs: one about module
> scoping of introduced toplevel identifiers, and another about the
> symbolic names of introduced toplevel identifiers.  See
> https://savannah.gnu.org/bugs/?31472.)
>
> > So how can I make this to work in both contexts?
>
> Just use #'f instead of (datum->syntax #'name 'f).
>

I would love to use this, but when I tried that, the code failed in some
cases, maybe because of the bugs you mensioned? I will probable fix this
when you merge the fix mensioned above into stable
meanwhile one can use with-syntax-class etc like constructs if in local
scope.
/Stefan

[-- Attachment #2: Type: text/html, Size: 2008 bytes --]

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

* Re: rackets syntax parse
  2012-02-07 21:58           ` Stefan Israelsson Tampe
@ 2012-02-07 22:55             ` Andy Wingo
  2012-02-08 20:16               ` Stefan Israelsson Tampe
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Wingo @ 2012-02-07 22:55 UTC (permalink / raw)
  To: Stefan Israelsson Tampe; +Cc: guile-devel

On Tue 07 Feb 2012 22:58, Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:

>     Just use #'f instead of (datum->syntax #'name 'f).
>
> I would love to use this, but when I tried that, the code failed in
> some cases, maybe because of the bugs you mensioned?

Try on master, perhaps?

Andy
-- 
http://wingolog.org/



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

* Re: rackets syntax parse
  2012-02-07 22:55             ` Andy Wingo
@ 2012-02-08 20:16               ` Stefan Israelsson Tampe
  2012-02-08 21:50                 ` Stefan Israelsson Tampe
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Israelsson Tampe @ 2012-02-08 20:16 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

I tried, got, new errors. it looks like if we have
(syntax-case x () ((a b c) ...))

and if x is a list of syntax pattern then we do not match in master
but do match in stable-2.0

/stefan

;;; WARNING: compilation of
/home/stis/stis/src/guile-syntax-parse/syntax/parse/src/parse.scm failed:
;;; ERROR: Throw to key `vm-error' with args `(vm-run "VM: Stack overflow"
())'

This codee compiles under

On Tue, Feb 7, 2012 at 11:55 PM, Andy Wingo <wingo@pobox.com> wrote:

> On Tue 07 Feb 2012 22:58, Stefan Israelsson Tampe <stefan.itampe@gmail.com>
> writes:
>
> >     Just use #'f instead of (datum->syntax #'name 'f).
> >
> > I would love to use this, but when I tried that, the code failed in
> > some cases, maybe because of the bugs you mensioned?
>
> Try on master, perhaps?
>
> Andy
> --
> http://wingolog.org/
>

[-- Attachment #2: Type: text/html, Size: 1345 bytes --]

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

* Re: rackets syntax parse
  2012-02-08 20:16               ` Stefan Israelsson Tampe
@ 2012-02-08 21:50                 ` Stefan Israelsson Tampe
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Israelsson Tampe @ 2012-02-08 21:50 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 3464 bytes --]

Hmm,

The problems on master is not due to beeing a list a I thought. Is there
anything wrong with

(syntax-case x (integrate)
                          [(integrate predicate description)
                           (pk 'matched)
                           #'(make-integrate #'predicate
                                             'description)]
                          [#f
                           #''#f])])

x =
(#(syntax-object integrate ((m-7SKZ$evMo3A5a3cVUSaE3A-12230 top) #(ribcage
() () ()) #(ribcage #(l) #((m-7SKZ$evMo3A5a3cVUSaE3A-12230 top))
#("l-7SKZ$evMo3A5a3cVUSaE3A-12240")) #(ribcage (integrate-description
integrate-predicate integrate? make-integrate integrate integrate-fkns)
((top) (top) (top) (top) (top) (top)) (((hygiene syntax parse src rep-data)
. #(syntax-object integrate-description ((top)) (hygiene syntax parse src
rep-data))) ((hygiene syntax parse src rep-data) . #(syntax-object
integrate-predicate ((top)) (hygiene syntax parse src rep-data))) ((hygiene
syntax parse src rep-data) . #(syntax-object integrate? ((top)) (hygiene
syntax parse src rep-data))) ((hygiene syntax parse src rep-data) .
#(syntax-object make-integrate ((top)) (hygiene syntax parse src
rep-data))) ((hygiene syntax parse src rep-data) . #(syntax-object
integrate ((top)) (hygiene syntax parse src rep-data))) ((hygiene syntax
parse src rep-data) . #(syntax-object integrate-fkns ((top)) (hygiene
syntax parse src rep-data))))) shift #(ribcage () () ()) #(ribcage #(q mk ?
fn n i) #((top) (top) (top) (top) (top) (top))
#("l-7SKZ$evMo3A5a3cVUSaE3A-1112" "l-7SKZ$evMo3A5a3cVUSaE3A-1113"
"l-7SKZ$evMo3A5a3cVUSaE3A-1114" "l-7SKZ$evMo3A5a3cVUSaE3A-1115"
"l-7SKZ$evMo3A5a3cVUSaE3A-1116" "l-7SKZ$evMo3A5a3cVUSaE3A-1117")) #(ribcage
() () ()) #(ribcage () () ()) #(ribcage #(nm) #((top))
#("l-7SKZ$evMo3A5a3cVUSaE3A-1107")) #(ribcage #(name field) #((top) (top))
#("l-7SKZ$evMo3A5a3cVUSaE3A-1103" "l-7SKZ$evMo3A5a3cVUSaE3A-1104"))
#(ribcage () () ()) #(ribcage #(x) #((top))
#("l-7SKZ$evMo3A5a3cVUSaE3A-1100")) #(ribcage (define-struct) ((top))
(((hygiene syntax parse src misc) . #(syntax-object define-struct ((top))
(hygiene syntax parse src misc)))))) (hygiene syntax parse src misc))
#(syntax-object t-1375 ((top)) (hygiene syntax parse src lib))
#(syntax-object "identifier" ((#f top) shift #(ribcage () () ())) (hygiene
syntax parse src lib)))

x do have the simple structure of
((syntax integrate) (syntax t-1375) (syntax "identifier"))

Something in the syntax structure has to be corrupt!

On Wed, Feb 8, 2012 at 9:16 PM, Stefan Israelsson Tampe <
stefan.itampe@gmail.com> wrote:

> I tried, got, new errors. it looks like if we have
> (syntax-case x () ((a b c) ...))
>
> and if x is a list of syntax pattern then we do not match in master
> but do match in stable-2.0
>
> /stefan
>
> ;;; WARNING: compilation of
> /home/stis/stis/src/guile-syntax-parse/syntax/parse/src/parse.scm failed:
> ;;; ERROR: Throw to key `vm-error' with args `(vm-run "VM: Stack overflow"
> ())'
>
> This codee compiles under
>
>
> On Tue, Feb 7, 2012 at 11:55 PM, Andy Wingo <wingo@pobox.com> wrote:
>
>> On Tue 07 Feb 2012 22:58, Stefan Israelsson Tampe <
>> stefan.itampe@gmail.com> writes:
>>
>> >     Just use #'f instead of (datum->syntax #'name 'f).
>> >
>> > I would love to use this, but when I tried that, the code failed in
>> > some cases, maybe because of the bugs you mensioned?
>>
>> Try on master, perhaps?
>>
>> Andy
>> --
>> http://wingolog.org/
>>
>
>

[-- Attachment #2: Type: text/html, Size: 4452 bytes --]

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

end of thread, other threads:[~2012-02-08 21:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-22 22:38 rackets syntax parse Stefan Israelsson Tampe
2012-01-25 20:37 ` Stefan Israelsson Tampe
2012-01-26 11:36   ` Andy Wingo
2012-01-27 21:13     ` Stefan Israelsson Tampe
2012-02-04 20:31       ` Stefan Israelsson Tampe
2012-02-07 21:37         ` Andy Wingo
2012-02-07 21:58           ` Stefan Israelsson Tampe
2012-02-07 22:55             ` Andy Wingo
2012-02-08 20:16               ` Stefan Israelsson Tampe
2012-02-08 21:50                 ` Stefan Israelsson Tampe

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).