thank you, i think now i understand better the macro syntax system of R6RS,
i will use all that to have in the next version of Scheme+ two systems:
-still the command line parser that parse for example infix (and slicing)
with operator precedence to prefix
-a transparent system for the user that will use macro to pre-parse the
code (no need to parse it in command line) on the fly (like the command
line parser do it) at the pre-compil stage of the macro,then use the
pre-parsed code in the expansion phase. Finally the run-time execution of
the generated code will be faster as no parsing will be done at this
run-time phase.All that being compatible with the syntax of Guile using
curli-infix SRFI 105.

Just a lot of code to refactor to use both symbolic expression (sexpr) in
the parser mode and now syntactic expression with the macros (modify
$brackett-apply$ $nfx$ etc ... and the procedure called by those).
With syntax it is more easy to manipulate special form like 'and' / 'or'
that cannot be manipulate like procedures * + - / unless quoted which is
not a good thing because when quoted the re-evaluation always cause
problems.(different environment when eval) The use of syntax avoid this
problem.(which does not exist indeed in the command line parser as i only
parse symbolic code)
Using R6RS syntax the hygiene too should be better.


On Sat, May 11, 2024 at 9:14 PM Jean Abou Samra <j...@abou-samra.fr> wrote:

> > the problem when pre-compiling/pre-computing those lists is that with #'
> ,
> > i mean syntax, the optimizer-parse-square-brackets-arguments-lister no
> > more receive  lists but this sort of expression:
> >
> > scheme@(guile-user)> (define T (make-vector 7))
> > scheme@(guile-user)> {T[2 + 1] <- 7}
> > <- : #'(index ...) = (#<syntax:unknown file:3:3 2> #<syntax:unknown
> file:3:5 +> #<syntax:unknown file:3:7 1>)
> > <- : (syntax->datum #'(index ...)) = (2 + 1)
> > optimizer-parse-square-brackets-arguments-lister :
> args-brackets=(#<syntax:unknown file:3:3 2> #<syntax:unknown file:3:5 +>
> #<syntax:unknown file:3:7 1>)
>
> Yes, these are wrapped syntax objects.
>
> > my question is how to deal with that?
>
> There are a variety of tools to work with syntax objects, just like
> there are tools to work with lists. Among them: syntax (#'),
> quasisyntax (#`), unsyntax (#,), unsyntax-splicing (#,@),
> identifier?, free-identifier=?, bound-identifier=?, and of
> course syntax-case.
>
> > becaue in the parser i check ,for example for + being '+ not some sort
> of #<syntax:unknown file:3:5 +>
> > i suppose the problem come from here
> > should i modify the parser to check for #'+ #'- #'* #'/ #'expt #'and
> #'or etc... or is there something to do when i pass arguments in the macro?
>
> Use (free-identifier=? the-identifier #'+)
>
> > also i pass #'(index ...) creating a sort of ( ) list ,how to pass th
> index and ellipsis in a syntax form ?? should i put that in a list with
> list procedure?
>
> #'(index ...) is a traditional list (not a wrapped syntax object), so you
> can work with it directly (its elements are wrapped syntax objects).
>
>
>
>

Reply via email to