[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1421: problems with building json egg in c5 egg
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1421: problems with building json egg in c5 egg repo |
Date: |
Thu, 19 Oct 2017 14:02:08 -0000 |
#1421: problems with building json egg in c5 egg repo
---------------------------------+-----------------
Reporter: felix | Owner:
Type: defect | Status: new
Priority: critical | Milestone: 5.0
Component: expander | Version: 5.0
Resolution: | Keywords:
Estimated difficulty: hard |
---------------------------------+-----------------
Comment (by sjamaan):
I believe this is a bug in how packrat works:
{{{
(import packrat)
(define plus-or-minus
(packrat-parser
(begin
(print "here be a define")
expr)
(expr ((a <- '+)
(print "plus: " a))
((a <- '-)
(print "minus: " a)))))
}}}
Compiling this with {{{csc -debug 2}}} produces:
{{{
[canonicalized]
(##core#callunit library)
(##core#callunit eval)
(##core#undefined)
(##core#undefined)
(##core#undefined)
(chicken.load#load-extension 'packrat '(packrat#) 'require)
(set! minus
(let ()
(let ((expr31 (##core#undefined)))
(let ((t58 (set! expr31
(##core#lambda
(results2632)
(packrat#results->result
results2632
'expr
(##core#lambda
()
(let ((g3334 (packrat#packrat-or
(packrat#packrat-check-base
'+
(##core#lambda
(a42)
(##core#lambda
(results4446)
(packrat#make-result
(chicken.base#print
'"plus: " a42)
results4446))))
(packrat#packrat-check-base
'-
(##core#lambda
(a53)
(##core#lambda
(results5557)
(packrat#make-result
(chicken.base#print
'"minus: " a53)
results5557)))))))
(g3334 results2632))))))))
(let ((t59 (chicken.base#print '"here be a define"))) expr31)))))
((##sys#implicit-exit-handler))
}}}
As you can see, the expansion of the internal define of json would look
something like:
{{{
(set! parser
(let ()
(let (...) ;; parser definitions used by begin
(let ((t59 (begin (define (white results) ...)))) ... expr))))
}}}
This is clearly incorrect: you can't put {{{define}}} in the value
expression of a let-variable.
--
Ticket URL: <https://bugs.call-cc.org/ticket/1421#comment:1>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.