# R6RS error in syntax parsing

**URL:** <https://racket.discourse.group/t/r6rs-error-in-syntax-parsing/3344>\
**Category:** Questions & Answers\
**Created:** [November 21, 2024, 11:10am UTC](https://racket.discourse.group/t/r6rs-error-in-syntax-parsing/3344 "2024-11-21T11:10:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [November 21, 2024, 11:10am UTC](https://racket.discourse.group/t/r6rs-error-in-syntax-parsing/3344/1 "2024-11-21T11:10:56Z")

</div>

hello,

i have a code in two versions, Racket and R6RS. The R6RS has a bug i donot understand , even if i can make works the Racket and R6RS with different versions, this version is buggy in R6RS, so i trace all the intermediate variables and they display the same till at end it fails in R6RS with this error:

```scheme
../infix-with-precedence-to-prefix.sls:372:16: mcar: contract violation
  expected: mpair?
  given: #<syntax ()>

```

line 372 is :

```scheme
(map (lambda (x) (recall-infix-parser x operator-precedence creator)) ;; recall-infix-parser
		     terms-local)

```

i suppose mcar is in map ,but then why map failed on #\<syntax ()\> ? perheaps is it awaiting '() and not a syntax object. The strange fact is that this sort error is sometimes related to psyntax (Portable syntax)

map is called with this object as argument terms-local:

```scheme
(#<syntax (2 * 0.3)> . #<syntax ()>)

```

note: i'm not sure the display of the object is the same as in memory as it contains syntax (sometimes i have bad surprise about that...)

my output is this:

```scheme
> (define-infix a (2 * .3))

(define-infix a (2 * 0.3))
$nfx$: #'(expr)=(.#<syntax (2 * 0.3)> . .#<syntax ()>)
!*prec-generic : deep-terms : terms=(.#<syntax (2 * 0.3)> . .#<syntax ()>)
!*prec-generic : deep-terms : WARNING , terms is not a list, perheaps expander is not psyntax (Portable Syntax)
!*prec-generic : deep-terms : terms=(.#<syntax (2 * 0.3)> . .#<syntax ()>)
!*prec-generic : deep-terms : terms-local=(.#<syntax (2 * 0.3)> . .#<syntax ()>)
recall-infix-parser : expr =.#<syntax (2 * 0.3)>
recall-infix-parser : detected syntax,passing from syntax to list (will be used if it is a list)
recall-infix-parser : got a list
!*prec-generic : deep-terms : terms=(.#<syntax 2> .#<syntax *> .#<syntax 0.3>)
!*prec-generic : deep-terms : terms-local=(.#<syntax 2> .#<syntax *> .#<syntax 0.3>)
recall-infix-parser : expr =.#<syntax 2>
recall-infix-parser : detected syntax,passing from syntax to list (will be used if it is a list)
recall-infix-parser : expr not list.
recall-infix-parser : expr =.#<syntax *>
recall-infix-parser : detected syntax,passing from syntax to list (will be used if it is a list)
recall-infix-parser : expr not list.
recall-infix-parser : expr =.#<syntax 0.3>
recall-infix-parser : detected syntax,passing from syntax to list (will be used if it is a list)
recall-infix-parser : expr not list.
. . ../infix-with-precedence-to-prefix.sls:372:16: mcar: contract violation
  expected: mpair?
  given: #<syntax ()>

```

i can not provide the code in Discourse it is too big ,nor release it on github as it is unstable (but another version that use directly recall-infix-parser and not the classic !\*prec-generic works) but that is not the problem, i want to understand... but i can provide the code if someone want to look inside.
